Skip to content

Commit ed8a7d5

Browse files
author
Kelly Selden
committed
replace ember addon with ember new -b addon
1 parent b1b610b commit ed8a7d5

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

src/get-start-and-end-commands.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,19 @@ module.exports = function getStartAndEndCommands({
4141
function buildCommand(projectName, blueprint) {
4242
let isCustomBlueprint = blueprint.name !== 'ember-cli';
4343

44-
let command = 'new';
45-
if (blueprint.type === 'addon') {
46-
command = 'addon';
47-
}
48-
49-
command += ` ${projectName} -sn -sg`;
44+
let command = `new ${projectName} -sn -sg`;
5045

46+
let blueprintPath;
5147
if (isCustomBlueprint) {
52-
command += ` -b ${blueprint.path}`;
48+
blueprintPath = blueprint.path;
49+
} else if (blueprint.type === 'addon') {
50+
blueprintPath = 'addon';
51+
} else {
52+
blueprintPath = 'app';
5353
}
5454

55+
command += ` -b ${blueprintPath}`;
56+
5557
if (blueprint.options.length) {
5658
command += ` ${blueprint.options.join(' ')}`;
5759
}

src/load-safe-default-blueprint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function loadSafeDefaultBlueprint(projectOptions, version) {
1010
if (projectOptions.includes('yarn')) {
1111
options.push('--yarn');
1212
}
13-
if (!projectOptions.includes('welcome') && !projectOptions.includes('addon')) {
13+
if (!projectOptions.includes('welcome') || projectOptions.includes('addon')) {
1414
options.push('--no-welcome');
1515
}
1616

test/integration/load-safe-default-blueprint-test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ describe(_loadSafeDefaultBlueprint, function() {
9898
name: 'ember-cli',
9999
type: 'addon',
100100
version,
101-
options: []
101+
options: [
102+
'--no-welcome'
103+
]
102104
});
103105
});
104106

@@ -112,7 +114,8 @@ describe(_loadSafeDefaultBlueprint, function() {
112114
type: 'addon',
113115
version,
114116
options: [
115-
'--yarn'
117+
'--yarn',
118+
'--no-welcome'
116119
]
117120
});
118121
});

test/unit/get-start-and-end-commands-test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ describe(_getStartAndEndCommands, function() {
9898
'new',
9999
projectName,
100100
'-sn',
101-
'-sg'
101+
'-sg',
102+
'-b',
103+
'app'
102104
],
103105
{
104106
cwd
@@ -122,7 +124,7 @@ describe(_getStartAndEndCommands, function() {
122124
expect(await createProject(cwd)).to.equal(projectPath);
123125

124126
expect(npxStub.args).to.deep.equal([[
125-
`-p ${packageName}@${packageVersion} ${commandName} new ${projectName} -sn -sg`,
127+
`-p ${packageName}@${packageVersion} ${commandName} new ${projectName} -sn -sg -b app`,
126128
{
127129
cwd
128130
}
@@ -293,7 +295,7 @@ describe(_getStartAndEndCommands, function() {
293295
expect(await createProject(cwd)).to.equal(projectPath);
294296

295297
expect(npxStub.args).to.deep.equal([[
296-
`-p ${packageName}@${packageVersion} ${commandName} new ${projectName} -sn -sg`,
298+
`-p ${packageName}@${packageVersion} ${commandName} new ${projectName} -sn -sg -b app`,
297299
{
298300
cwd
299301
}
@@ -401,7 +403,7 @@ describe(_getStartAndEndCommands, function() {
401403

402404
let command = buildCommand(projectName, blueprint);
403405

404-
expect(command).to.equal('new my-project -sn -sg');
406+
expect(command).to.equal('new my-project -sn -sg -b app');
405407
});
406408

407409
it('works for default addon', function() {
@@ -413,7 +415,7 @@ describe(_getStartAndEndCommands, function() {
413415

414416
let command = buildCommand(projectName, blueprint);
415417

416-
expect(command).to.equal('addon my-project -sn -sg');
418+
expect(command).to.equal('new my-project -sn -sg -b addon');
417419
});
418420

419421
it('works for custom app', function() {
@@ -440,7 +442,7 @@ describe(_getStartAndEndCommands, function() {
440442

441443
let command = buildCommand(projectName, blueprint);
442444

443-
expect(command).to.equal('new my-project -sn -sg --my-option-1 --my-option-2');
445+
expect(command).to.equal('new my-project -sn -sg -b app --my-option-1 --my-option-2');
444446
});
445447
});
446448
});

0 commit comments

Comments
 (0)