Skip to content

Commit

Permalink
bugfix name arg
Browse files Browse the repository at this point in the history
  • Loading branch information
gossi committed Dec 23, 2018
1 parent b3b69f1 commit b161de9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions bin/ember-cli-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ programm
.option('--npm', 'Use npm as package manager (instead of yarn)')
.option('--welcome', 'To install the {{ember-welcome-page}}')
.action(function (name, options) {
const cmd = new CreateCommand({
name: name
}, options);
const cmd = new CreateCommand({ name }, options);
cmd.run();
});

Expand Down
4 changes: 4 additions & 0 deletions src/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ module.exports = class CreateCommand {
answers.preset = this.options.preset;
}

if (!answers.name && this.args.name) {
answers.name = this.args.name;
}

return this.compileConfig(answers);
}

Expand Down
10 changes: 6 additions & 4 deletions src/prompts/create-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function dasherize(str) {
module.exports = function (args, options) {
// put options into local variables (so they are overridable with answers)
let preset = options.preset;
let name = args.name;

return [
{
Expand Down Expand Up @@ -48,11 +49,12 @@ module.exports = function (args, options) {
message: 'What is the name of your project',
suffix: ':',
when: () => {
return !args.name;
return !name;
},
validate(input) {
if (input !== '') {
return true;
name = input;
return name;
}

return 'Please enter a name for your project';
Expand All @@ -62,8 +64,8 @@ module.exports = function (args, options) {
name: 'directory',
message: 'Where to create your project?',
suffix: ':',
default(answers) {
return './' + answers.name;
default() {
return './' + name;
},
validate(input) {
return input !== '';
Expand Down

0 comments on commit b161de9

Please sign in to comment.