Skip to content

Commit 74409da

Browse files
author
Kelly Selden
committed
prevent attempting createProjectFromCache when custom blueprint
1 parent 72a81f2 commit 74409da

3 files changed

Lines changed: 50 additions & 23 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"homepage": "https://github.com/ember-cli/ember-cli-update#readme",
3535
"engines": {
36-
"node": ">=8"
36+
"node": ">=8.10"
3737
},
3838
"files": [
3939
"bin",

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ module.exports = function getStartAndEndCommands({
3434
return {
3535
projectName,
3636
projectOptions,
37-
packageName: 'ember-cli',
38-
commandName: 'ember',
39-
// `createProjectFromCache` no longer works with blueprints.
40-
// It will look for an `ember-cli` version with the same
41-
// version as the blueprint.
42-
createProjectFromCache: createProjectFromCache(command),
37+
...projectOptions.includes('blueprint') ? {} : {
38+
packageName: 'ember-cli',
39+
commandName: 'ember',
40+
// `createProjectFromCache` no longer works with blueprints.
41+
// It would look for an `ember-cli` version with the same
42+
// version as the blueprint.
43+
createProjectFromCache: createProjectFromCache(command)
44+
},
4345
createProjectFromRemote: createProjectFromRemote(command),
4446
startOptions: {
4547
packageVersion: startVersion,

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

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,53 @@ describe(_getStartAndEndCommands, function() {
120120
]]);
121121
});
122122

123-
it('can create a project from a custom blueprint', async function() {
124-
let { createProjectFromRemote } = getStartAndEndCommands();
123+
describe('custom blueprint', function() {
124+
it('returns an options object', async function() {
125+
let options = getStartAndEndCommands({
126+
projectOptions: ['blueprint']
127+
});
125128

126-
let createProject = createProjectFromRemote({
127-
options: {
129+
expect(options.createProjectFromRemote).to.be.a('function');
130+
131+
delete options.createProjectFromRemote;
132+
133+
expect(options).to.deep.equal({
128134
projectName,
129-
packageVersion,
130-
blueprint: {
131-
name: blueprint,
132-
path: blueprintPath
135+
projectOptions: ['blueprint'],
136+
startOptions: {
137+
packageVersion: startVersion,
138+
blueprint: { name: 'ember-cli' }
139+
},
140+
endOptions: {
141+
packageVersion: endVersion,
142+
blueprint: { name: 'ember-cli' }
133143
}
134-
}
144+
});
135145
});
136146

137-
expect(await createProject(cwd)).to.equal(projectPath);
147+
it('can create a project from remote', async function() {
148+
let { createProjectFromRemote } = getStartAndEndCommands();
138149

139-
expect(npxStub.args).to.deep.equal([[
140-
`${packageName} new ${projectName} -sn -sg --no-welcome -b ${blueprintPath}`,
141-
{
142-
cwd
143-
}
144-
]]);
150+
let createProject = createProjectFromRemote({
151+
options: {
152+
projectName,
153+
packageVersion,
154+
blueprint: {
155+
name: blueprint,
156+
path: blueprintPath
157+
}
158+
}
159+
});
160+
161+
expect(await createProject(cwd)).to.equal(projectPath);
162+
163+
expect(npxStub.args).to.deep.equal([[
164+
`${packageName} new ${projectName} -sn -sg --no-welcome -b ${blueprintPath}`,
165+
{
166+
cwd
167+
}
168+
]]);
169+
});
145170
});
146171

147172
describe('options', function() {

0 commit comments

Comments
 (0)