feat(core): add error when root project would be '.' (#16999)
This commit is contained in:
parent
95421c6945
commit
024193fb5b
@ -762,6 +762,13 @@ function buildProjectConfigurationFromPackageJson(
|
|||||||
): ProjectConfiguration & { name: string } {
|
): ProjectConfiguration & { name: string } {
|
||||||
const normalizedPath = path.split('\\').join('/');
|
const normalizedPath = path.split('\\').join('/');
|
||||||
const directory = dirname(normalizedPath);
|
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);
|
let name = packageJson.name ?? toProjectName(normalizedPath);
|
||||||
if (nxJson?.npmScope) {
|
if (nxJson?.npmScope) {
|
||||||
const npmPrefix = `@${nxJson.npmScope}/`;
|
const npmPrefix = `@${nxJson.npmScope}/`;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user