Skip to content

Commit 455199a

Browse files
committed
fix(core): handle null npm scope properly
1 parent 13c0a2c commit 455199a

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

packages/core/src/generators/utils/generate-project.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
normalizePath,
99
ProjectConfiguration,
1010
ProjectType,
11-
readWorkspaceConfiguration,
1211
Tree,
1312
} from '@nrwl/devkit';
1413

@@ -96,16 +95,19 @@ function getNamespaceFromSchema(
9695
options: NxDotnetProjectGeneratorSchema,
9796
projectDirectory: string,
9897
): string {
99-
const npmScope = names(
100-
readWorkspaceConfiguration(host).npmScope || '',
101-
).className;
102-
const featureScope = projectDirectory
98+
const { npmScope } = getWorkspaceLayout(host);
99+
100+
const namespaceParts = projectDirectory
103101
// not sure why eslint complains here, testing in devtools shows different results without the escape character.
104102
// eslint-disable-next-line no-useless-escape
105103
.split(/[\/\\]/gm) // Without the unnecessary parentheses, the separator is excluded from the result array.
106104
.map((part: string) => names(part).className);
107105

108-
return [npmScope, ...featureScope].join('.');
106+
if (npmScope) {
107+
namespaceParts.unshift(names(npmScope).className);
108+
}
109+
110+
return namespaceParts.join('.');
109111
}
110112

111113
async function getTemplate(

tools/scripts/publish-all/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ export function publishAll(version: string, tag = 'latest') {
2222
NPM_CONFIG_REGISTRY: undefined,
2323
};
2424

25-
projects.forEach((projectConfiguration, idx) => {
25+
for (const projectConfiguration of projects) {
26+
if (projectConfiguration.root.includes('demo')) {
27+
continue;
28+
}
2629
const outputPath = projectConfiguration.targets?.build?.options?.outputPath;
2730
if (existsSync(`${outputPath}/package.json`)) {
2831
execSync(`npm publish ${outputPath} --tag=${tag} --access=public`, {
2932
stdio: 'inherit',
3033
env: environment,
3134
});
3235
}
33-
});
36+
}
3437
}
3538

3639
if (require.main === module) {

tools/scripts/publish-dev/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function main(version: string) {
99
version,
1010
)
1111
? rootPkg.version.split('-')
12-
: [version, null];
12+
: version.split('-');
1313
let [tag, rev] = tagSpec ? tagSpec.split('.') : ['beta', '0'];
1414
rev = (parseInt(rev) + 1).toString();
1515
rev = rev === 'NaN' ? '0' : rev;

0 commit comments

Comments
 (0)