Skip to content

Commit

Permalink
Allow passing gitInit, pkgManager and webpack through the CLI
Browse files Browse the repository at this point in the history
Closes #226
  • Loading branch information
TomasHubelbauer authored Nov 4, 2020
1 parent ea8867d commit a962e05
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion generators/app/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ exports.askForExtensionDescription = (generator, extensionConfig) => {
* @param {Object} extensionConfig
*/
exports.askForGit = (generator, extensionConfig) => {
let gitInit = generator.options['gitInit'];
if (gitInit === 'true' || gitInit === 'false') {
extensionConfig.gitInit = Boolean(gitInit);
return Promise.resolve();
}

return generator.prompt({
type: 'confirm',
name: 'gitInit',
Expand All @@ -97,6 +103,12 @@ exports.askForGit = (generator, extensionConfig) => {
* @param {Object} extensionConfig
*/
exports.askForPackageManager = (generator, extensionConfig) => {
let pkgManager = generator.options['pkgManager'];
if (pkgManager === 'npm' || pkgManager === 'yarn') {
extensionConfig.pkgManager = pkgManager;
return Promise.resolve();
}

extensionConfig.pkgManager = 'npm';
return generator.prompt({
type: 'list',
Expand All @@ -122,6 +134,12 @@ exports.askForPackageManager = (generator, extensionConfig) => {
* @param {Object} extensionConfig
*/
exports.askForWebpack = (generator, extensionConfig) => {
let webpack = generator.options['webpack'];
if (webpack === 'true' || webpack === 'false') {
extensionConfig.webpack = Boolean(webpack);
return Promise.resolve();
}

return generator.prompt({
type: 'confirm',
name: 'webpack',
Expand All @@ -130,4 +148,4 @@ exports.askForWebpack = (generator, extensionConfig) => {
}).then(gitAnswer => {
extensionConfig.webpack = gitAnswer.webpack;
});
}
}

0 comments on commit a962e05

Please sign in to comment.