fix(misc): workspaces using nx wrapper do not contain a package.json, so don't read the scope from it
This commit is contained in:
parent
be267a7cd9
commit
ae6e90c86d
@ -11,7 +11,9 @@ export function getNpmScope(tree: Tree): string | undefined {
|
|||||||
return nxJson.npmScope;
|
return nxJson.npmScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name } = readJson<{ name?: string }>(tree, 'package.json');
|
const { name } = tree.exists('package.json')
|
||||||
|
? readJson<{ name?: string }>(tree, 'package.json')
|
||||||
|
: { name: null };
|
||||||
|
|
||||||
if (name?.startsWith('@')) {
|
if (name?.startsWith('@')) {
|
||||||
return name.split('/')[0].substring(1);
|
return name.split('/')[0].substring(1);
|
||||||
|
|||||||
@ -17,7 +17,9 @@ function getNpmScope(tree: Tree) {
|
|||||||
return nxJson.npmScope;
|
return nxJson.npmScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name } = readJson<{ name?: string }>(tree, 'package.json');
|
const { name } = tree.exists('package.json')
|
||||||
|
? readJson<{ name?: string }>(tree, 'package.json')
|
||||||
|
: { name: null };
|
||||||
|
|
||||||
if (name?.startsWith('@')) {
|
if (name?.startsWith('@')) {
|
||||||
return name.split('/')[0].substring(1);
|
return name.split('/')[0].substring(1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user