Skip to content

Commit

Permalink
fix projectName if there is no package.json name
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Sep 28, 2023
1 parent c84141b commit 640446c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
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

0 comments on commit 640446c

Please sign in to comment.