Navigation Menu

Skip to content

Commit

Permalink
feat: add deprecate message (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Mar 28, 2019
1 parent 9f459a9 commit a1512e4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Expand Up @@ -2,6 +2,7 @@ environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '8'
- nodejs_version: '10'

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
33 changes: 29 additions & 4 deletions lib/init_command.js
Expand Up @@ -80,9 +80,10 @@ module.exports = class Command {
// ask for boilerplate
let boilerplate;
if (argv.type && boilerplateMapping.hasOwnProperty(argv.type)) {
boilerplate = boilerplateMapping[ argv.type ];
boilerplate = boilerplateMapping[argv.type];
} else {
boilerplate = yield this.askForBoilerplateType(boilerplateMapping);
if (!boilerplate) return;
}
this.log(`use boilerplate: ${boilerplate.name}(${boilerplate.package})`);
pkgName = boilerplate.package;
Expand Down Expand Up @@ -164,14 +165,38 @@ module.exports = class Command {
});

choices.unshift(new inquirer.Separator());
const answers = yield inquirer.prompt({
name: 'type',
const { boilerplateInfo } = yield inquirer.prompt({
name: 'boilerplateInfo',
type: 'list',
message: 'Please select a boilerplate type',
choices,
pageSize: choices.length,
});
return answers.type;
if (!boilerplateInfo.deprecate) return boilerplateInfo;

// ask for deprecate
const { shouldInstall } = yield inquirer.prompt({
name: 'shouldInstall',
type: 'list',
message: 'It\'s deprecated',
choices: [
{
name: `1. ${boilerplateInfo.deprecate}`,
value: false,
},
{
name: '2. I still want to continue installing',
value: true,
},
],
});

if (shouldInstall) {
return boilerplateInfo;
} else {
console.log(`Exit due to: ${boilerplateInfo.deprecate}`.deprecate);
return;
}
}

/**
Expand Down

0 comments on commit a1512e4

Please sign in to comment.