Skip to content

Commit 18e38b3

Browse files
committed
chore: fix getting npmScope
1 parent de016ff commit 18e38b3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/nx-npm/src/executors/publish/lib/normalize-options.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
import { ExecutorContext, readNxJson } from '@nrwl/devkit';
1+
import { ExecutorContext } from '@nrwl/devkit';
22
import { getProjectConfiguration } from '@ns3/nx-core';
33
import { PublishExecutorNormalizedSchema, PublishExecutorSchema } from '../schema';
44

55
export function normalizeOptions(
66
options: PublishExecutorSchema,
77
context: ExecutorContext,
88
): PublishExecutorNormalizedSchema {
9-
const nx = readNxJson();
9+
const npmScope = context.workspace?.npmScope;
10+
11+
if (!npmScope) {
12+
throw new Error('Missing npmScope in workspace');
13+
}
1014

1115
return {
1216
...options,
1317
npmToken: getNpmToken(options),
1418
pkgLocation: getPkgLocation(options, context),
15-
npmScope: nx.npmScope,
19+
npmScope: npmScope,
1620
pkgVersion: options.pkgVersion || process.env['NPM_PACKAGE_VERSION'],
1721
tag: options.tag || process.env['NPM_PACKAGE_TAG'] || 'latest',
1822
};

0 commit comments

Comments
 (0)