From 4911e6a79319c1ba4c058c6ccddb03e8a1ad82cd Mon Sep 17 00:00:00 2001 From: Duncan Paterson Date: Tue, 12 Jan 2021 13:55:28 +0100 Subject: [PATCH 1/2] ignore(index,gulpfile): scaffolding and todos see #563 --- generators/app/index.js | 23 ++++++++++++++++------- generators/app/templates/gulpfile.js | 5 +++++ 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 generators/app/templates/gulpfile.js diff --git a/generators/app/index.js b/generators/app/index.js index 0293590b..66c9cc8a 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -7,8 +7,6 @@ const stripBom = require('gulp-stripbom') const validateElementName = require('validate-element-name') const pjson = require('../../package.json') -// Var isodate = (new Date()).toISOString(); - // Potential location for teipub defaults. see https://github.com/enquirer/enquirer/issues/15 module.exports = class extends Generator { initializing () { @@ -122,10 +120,10 @@ module.exports = class extends Generator { return nameValidation.isValid } }, - // TODO: [yo] Make these options meaningful + // TODO: line-o [gulp] Promp user for build system // { // type: 'checkbox', - // choices: ['ant', 'gulp', 'maven', 'gradle'], + // choices: ['ant', 'gulp'], // name: 'builder', // message: 'How would you like to build your app?', // default: 'ant' @@ -366,7 +364,7 @@ module.exports = class extends Generator { }] // TODO: [yo]: js, css, gulp, funcdoc, - // TODO: [gulp] https://github.com/bnjjj/generator-gulpfile-advanced + // TODO: [gulp] line-o we could also extend this module https://github.com/bnjjj/generator-gulpfile-advanced return this.prompt(prompts).then(props => { // To access props later use this.props.someAnswer; @@ -447,6 +445,7 @@ module.exports = class extends Generator { } // TODO html -> xhtml // Applies to all (build, expath-pkg, repo, xqs) + // TODO: [gulp] line-o here build.xml is copied for all outputs by default needs to become conditional this.fs.copyTpl( this.templatePath('build.xml'), this.destinationPath('build.xml'), { @@ -519,6 +518,13 @@ module.exports = class extends Generator { this.destinationPath('icon.png') ) } + // TODO: [gulp] line-o here we could add another if for libraries + // if (this.props.apptype[1] === 'library') { + // this.fs.copyTpl( + // this.templatePath('gulpfile.js'), + // this.destinationPath('gulpfile.js'), { someprop: this.props.something} + // ) + // } // not polymer (flexible) if (this.props.apptype[0] !== 'empty' && this.props.apptype[0] !== 'polymer') { this.fs.copyTpl( @@ -571,6 +577,7 @@ module.exports = class extends Generator { apptype: this.props.apptype[0] }) // Poly2 template is deprecated + // TODO: line-o potential template for how to expand package.json with devDeps Object.assign(pkgJson.devDependencies, { 'brace-expansion': '^1.1.4', del: '^2.2.0', @@ -829,6 +836,7 @@ module.exports = class extends Generator { } // no prompt + // TODO: see #562 // CI, mocha, cypress testing (no prompts) this.fs.copyTpl( this.templatePath('ci/.travis.yml'), @@ -837,7 +845,7 @@ module.exports = class extends Generator { } ) - // TODO these will need to be adapted for polymer apps + // TODO these will need to be adapted for publisher apps // Mocha this.fs.copy( this.templatePath('tests/mocha/app_spec.js'), @@ -922,6 +930,7 @@ module.exports = class extends Generator { this.bowerInstall() } + // TODO: [gulp] line-o this is how i used to run Gulp for tei-pub apps back in the day // this will start the default polymer cli // if (this.props.apptype[0] === 'polymer') { // this.spawnCommandSync('polymer', ['init', this.props.polytempl[1]]) @@ -936,7 +945,7 @@ module.exports = class extends Generator { } this.spawnCommandSync('ant', '-q') - // conditional gulp watch + // TODO: [gulp] line-o conditional gulp watch // if (this.props.apptype[0] === 'polymer') { // this.spawnCommandSync('gulp', ['watch']) // } diff --git a/generators/app/templates/gulpfile.js b/generators/app/templates/gulpfile.js new file mode 100644 index 00000000..c31be9ed --- /dev/null +++ b/generators/app/templates/gulpfile.js @@ -0,0 +1,5 @@ +// TODO: line-o tell me what you want what you really really … +// see https://docs.google.com/document/d/1UdSWERC9rCSYIYjTGgCr3avce47h5OeLFR4tGKYXZlM/edit#heading=h.ei4sqy3ojpkl +// see https://github.com/line-o/gulp-exist-example/blob/main/gulpfile.js +// see https://github.com/eXist-db/documentation/blob/master/Gulpfile.js +// see #563 \ No newline at end of file From 1117e75fffbfc16c47f435b3312054a077ff12a2 Mon Sep 17 00:00:00 2001 From: Duncan Paterson Date: Wed, 13 Jan 2021 22:45:19 +0100 Subject: [PATCH 2/2] chore(test): more gulp todos see #563 --- generators/app/index.js | 3 ++- test/generated-pkg/app-empty.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/generators/app/index.js b/generators/app/index.js index 66c9cc8a..f5a246ec 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -943,7 +943,8 @@ module.exports = class extends Generator { this.spawnCommandSync('git', ['add', '--all']) this.spawnCommandSync('git', ['commit', '-q', '-m', '\'initial scaffolding by Yeoman\'']) } - this.spawnCommandSync('ant', '-q') + // TODO: [gulp] line-o make conditional on selected build tool + this.spawnCommandSync('ant', '-q') // TODO: [gulp] line-o conditional gulp watch // if (this.props.apptype[0] === 'polymer') { diff --git a/test/generated-pkg/app-empty.js b/test/generated-pkg/app-empty.js index 7b9431f1..98bc529d 100644 --- a/test/generated-pkg/app-empty.js +++ b/test/generated-pkg/app-empty.js @@ -6,6 +6,9 @@ const fs = require('fs-extra') describe('empty package', function () { this.timeout(15000) + // TODO: #563 [gulp] line-o let's make this the test application for pure gulp build + // we should also add a second app-lib-gulp bringing some of the old polymer file checks + // over and testing the proper gulpfile contents for libs vs apps before(async function () { await helpers.run(path.join(__dirname, '../../generators/app')) .withPrompts({