Skip to content

Commit

Permalink
enhancements: ask if user wants to make the config at end
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed May 6, 2017
1 parent 3e6115a commit 0ba9d7d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/creator/yeoman/webpack-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,29 @@ module.exports = class WebpackGenerator extends Generator {
});
}
installPlugins() {
let asyncDone = this.async();
this.npmInstall(['uglifyjs-webpack-plugin'], { 'save-dev': true });
this.configuration.config.webpackOptions.plugins.forEach( (plugin) => {
if(plugin.indexOf('new ExtractTextPlugin') >= 0) {
this.npmInstall(['extract-text-webpack-plugin'], { 'save-dev': true });
}
});
this.prompt([
RawList(
'finish',
'Everything is set! Do you want to create your webpack.config.js?',
['Yes', 'No']
)
]).then( (answer) => {
if(answer['finish'] === 'Yes') {
asyncDone();
} else {
process.stdout.write(
chalk.bold.red('\nInitializing aborted, run \'webpack init\' again if this was not intended.\n')
);
process.exitCode = 0;
}
});
}

};

0 comments on commit 0ba9d7d

Please sign in to comment.