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

fix projectName if there is no package.json name #1249

Merged
merged 1 commit into from
Sep 28, 2023
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
15 changes: 13 additions & 2 deletions src/get-start-and-end-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@ const nodeModulesIgnore = `
const lastNode8Version = '3.16';

module.exports = function getStartAndEndCommands({
packageJson: { name: projectName },
packageJson,
baseBlueprint,
startBlueprint,
endBlueprint
endBlueprint,
emberCliUpdateJson
}) {
// ember-cli-update.json can override projectName and we should use the name field in package.json if it doesn't exist
let projectName = emberCliUpdateJson?.projectName ?? packageJson.name;

// if we haven't overridden projectName in ember-cli-update or we don't have a name in the package.json file
// default to containing dir name
if (!projectName) {
let pathParts = process.cwd().split(path.sep);
projectName = pathParts[pathParts.length - 1];
}

if (baseBlueprint && !baseBlueprint.isBaseBlueprint) {
throw new Error('The intended base blueprint is not actually a base blueprint.');
}
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ module.exports = async function emberCliUpdate({
packageJson,
baseBlueprint,
startBlueprint,
endBlueprint
endBlueprint,
emberCliUpdateJson
});

return {
Expand Down