Skip to content

Commit

Permalink
feat(core): add error when root project would be '.' (nrwl#16999)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored May 12, 2023
1 parent 95421c6 commit 024193f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/nx/src/config/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,13 @@ function buildProjectConfigurationFromPackageJson(
): ProjectConfiguration & { name: string } {
const normalizedPath = path.split('\\').join('/');
const directory = dirname(normalizedPath);

if (!packageJson.name && directory === '.') {
throw new Error(
'Nx requires the root package.json to specify a name if it is being used as an Nx project.'
);
}

let name = packageJson.name ?? toProjectName(normalizedPath);
if (nxJson?.npmScope) {
const npmPrefix = `@${nxJson.npmScope}/`;
Expand Down

0 comments on commit 024193f

Please sign in to comment.