dotherightthing/generator-wpdtrt-plugin-boilerplate

Reduce duplication by targeting scripts & config files in boilerplate

Closed this issue · 10 comments

It's time consuming to tweak plugin settings, because many need to be duplicated across all existing plugins.

See also dotherightthing/wpdtrt-plugin-boilerplate#107


.jshintrc could be replaced with .eslintrc.

.eslintrc can load nested config files like so:

{
  "extends": "./node_modules/eslint-config-airbnb-base/.eslintrc"
}

The dummy gulpfile.js could be removed and scripts could be specified and run from package.json:

  "scripts": {
    "build": "gulp --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./",
    "install": "gulp install_dependencies --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./ && gulp wpunit_install --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./",
    "package": "gulp docs --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./ && gulp release --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./",
    "test": "gulp lint --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./ && gulp wpunit_run --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./",
    "version": "gulp version --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./",
    "watch": "gulp compile --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./ && gulp watch --gulpfile ./vendor/dotherightthing/wpdtrt-plugin-boilerplate/gulpfile.js --cwd ./"
  },

This creates 6 syntactically simple tasks:

  1. npm run build / yarn run build
  2. npm run install / yarn run install
  3. npm run package / yarn run package
  4. npm run test / yarn run test
  5. npm run version / yarn run version
  6. npm run watch / yarn run watch

These tasks can also be discovered by running:

  • npm run / yarn run

phpdoc.dist.xml can be specified via the --config CLI option

phpunit.xml.dist could be removed, but I'm not sure how SublimeLinter would be able to discover it - but does sublime use it ??

Gemfile and Gemfile.lock could be replaced by .sass-lint.yml, but I'm not sure how SublimeLinter would be able to discover this if it was nested

.jsdocConfig is already being loaded from the boilerplate (TODO: but the path is relative to the boilerplate)

Refactor test-wpdtrt-pluginname.php to extend a shared class stored in the boilerplate

.sass-lint.yml can't load external configs yet - sasstools/sass-lint#733

Added in 0.7.21

TODO: Update generated plugins to 0.7.25