Skip to content

Commit 5005cca

Browse files
committed
fix projectName if there is no package.json name
1 parent c84141b commit 5005cca

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,22 @@ const nodeModulesIgnore = `
2323
const lastNode8Version = '3.16';
2424

2525
module.exports = function getStartAndEndCommands({
26-
packageJson: { name: projectName },
26+
packageJson,
2727
baseBlueprint,
2828
startBlueprint,
29-
endBlueprint
29+
endBlueprint,
30+
emberCliUpdateJson
3031
}) {
32+
// ember-cli-update.json can override projectName and we should use the name field in package.json if it doesn't exist
33+
let projectName = emberCliUpdateJson?.projectName ?? packageJson.name;
34+
35+
// if we haven't overridden projectName in ember-cli-update or we don't have a name in the package.json file
36+
// default to containing dir name
37+
if (!projectName) {
38+
let pathParts = process.cwd().split(path.sep);
39+
projectName = pathParts[pathParts.length - 1];
40+
}
41+
3142
if (baseBlueprint && !baseBlueprint.isBaseBlueprint) {
3243
throw new Error('The intended base blueprint is not actually a base blueprint.');
3344
}

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ module.exports = async function emberCliUpdate({
214214
packageJson,
215215
baseBlueprint,
216216
startBlueprint,
217-
endBlueprint
217+
endBlueprint,
218+
emberCliUpdateJson
218219
});
219220

220221
return {

0 commit comments

Comments
 (0)