diff --git a/lib/generate-plugin/plugin-generator.js b/lib/generate-plugin/plugin-generator.js index 8d01db2509c..c39c7f19e5f 100644 --- a/lib/generate-plugin/plugin-generator.js +++ b/lib/generate-plugin/plugin-generator.js @@ -42,6 +42,10 @@ class PluginGenerator extends Generator { } writing() { + /** + * Plugin source + */ + this.fs.copyTpl( path.join(__dirname, 'templates', 'src', '_index.js.tpl'), this.destinationPath('src/index.js'), @@ -52,10 +56,49 @@ class PluginGenerator extends Generator { path.join(__dirname, 'templates', 'src', 'cjs.js.tpl'), this.destinationPath('src/cjs.js') ); + + /** + * Tests + */ + + this.fs.copy( + path.join(__dirname, 'templates', 'test', 'test-utils.js.tpl'), + this.destinationPath('test/test-utils.js') + ); + + this.fs.copy( + path.join(__dirname, 'templates', 'test', 'functional.test.js.tpl'), + this.destinationPath('test/functional.test.js') + ); + + /** + * Examples + */ + + this.fs.copyTpl( + path.join(__dirname, 'templates', 'examples', 'simple', 'webpack.config.js.tpl'), + this.destinationPath('examples/simple/webpack.config.js'), + { name: _.upperFirst(_.camelCase(this.props.name)) } + ); + + this.fs.copy( + path.join(__dirname, 'templates', 'examples', 'simple', 'src','index.js.tpl'), + this.destinationPath('examples/simple/src/index.js') + ); + + this.fs.copy( + path.join(__dirname, 'templates', 'examples', 'simple', 'src','lazy-module.js.tpl'), + this.destinationPath('examples/simple/src/lazy-module.js') + ); + + this.fs.copy( + path.join(__dirname, 'templates', 'examples', 'simple', 'src','static-esm-module.js.tpl'), + this.destinationPath('examples/simple/src/static-esm-module.js') + ); } install() { - this.npmInstall(['webpack-defaults'], { 'save-dev': true }).then(() => { + this.npmInstall(['webpack-defaults', 'bluebird'], { 'save-dev': true }).then(() => { this.spawnCommand('npm', ['run', 'webpack-defaults']); }); }