Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent attempting createProjectFromCache when custom blueprint #636

Merged
merged 1 commit into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"homepage": "https://github.com/ember-cli/ember-cli-update#readme",
"engines": {
"node": ">=8"
"node": ">=8.10"
},
"files": [
"bin",
Expand Down
14 changes: 8 additions & 6 deletions src/get-start-and-end-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ module.exports = function getStartAndEndCommands({
return {
projectName,
projectOptions,
packageName: 'ember-cli',
commandName: 'ember',
// `createProjectFromCache` no longer works with blueprints.
// It will look for an `ember-cli` version with the same
// version as the blueprint.
createProjectFromCache: createProjectFromCache(command),
...projectOptions.includes('blueprint') ? {} : {
packageName: 'ember-cli',
commandName: 'ember',
// `createProjectFromCache` no longer works with blueprints.
// It would look for an `ember-cli` version with the same
// version as the blueprint.
createProjectFromCache: createProjectFromCache(command)
},
createProjectFromRemote: createProjectFromRemote(command),
startOptions: {
packageVersion: startVersion,
Expand Down
57 changes: 41 additions & 16 deletions test/unit/get-start-and-end-commands-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,53 @@ describe(_getStartAndEndCommands, function() {
]]);
});

it('can create a project from a custom blueprint', async function() {
let { createProjectFromRemote } = getStartAndEndCommands();
describe('custom blueprint', function() {
it('returns an options object', async function() {
let options = getStartAndEndCommands({
projectOptions: ['blueprint']
});

let createProject = createProjectFromRemote({
options: {
expect(options.createProjectFromRemote).to.be.a('function');

delete options.createProjectFromRemote;

expect(options).to.deep.equal({
projectName,
packageVersion,
blueprint: {
name: blueprint,
path: blueprintPath
projectOptions: ['blueprint'],
startOptions: {
packageVersion: startVersion,
blueprint: { name: 'ember-cli' }
},
endOptions: {
packageVersion: endVersion,
blueprint: { name: 'ember-cli' }
}
}
});
});

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

expect(npxStub.args).to.deep.equal([[
`${packageName} new ${projectName} -sn -sg --no-welcome -b ${blueprintPath}`,
{
cwd
}
]]);
let createProject = createProjectFromRemote({
options: {
projectName,
packageVersion,
blueprint: {
name: blueprint,
path: blueprintPath
}
}
});

expect(await createProject(cwd)).to.equal(projectPath);

expect(npxStub.args).to.deep.equal([[
`${packageName} new ${projectName} -sn -sg --no-welcome -b ${blueprintPath}`,
{
cwd
}
]]);
});
});

describe('options', function() {
Expand Down