fix(angular): return error when name is missing from package.json (#10356)

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
This commit is contained in:
Pascal Küsgen 2022-05-18 11:46:03 +02:00 committed by GitHub
parent a89c360f46
commit 0de895d35e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,10 @@ export function normalizeOptions(
if (!npmScope) { if (!npmScope) {
// use the name (scope if exists) in the root package.json // use the name (scope if exists) in the root package.json
const { name } = readJson(tree, 'package.json'); const { name } = readJson(tree, 'package.json');
npmScope = name.startsWith('@') ? name.split('/')[0].substring(1) : name;
if (name) {
npmScope = name.startsWith('@') ? name.split('/')[0].substring(1) : name;
}
} }
return { ...options, npmScope }; return { ...options, npmScope };