Skip to content

Commit

Permalink
Merge pull request #227 from TomasHubelbauer/patch-1
Browse files Browse the repository at this point in the history
Allow passing gitInit, pkgManager and webpack through the CLI
  • Loading branch information
aeschli authored Nov 13, 2020
2 parents 336abf6 + a962e05 commit f94cf95
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 f94cf95

Please sign in to comment.