@nx/js 24.0.2 → 24.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/executors/release-publish/release-publish.impl.js +16 -15
- package/dist/src/generators/typescript-sync/typescript-sync.js +3 -2
- package/dist/src/plugins/typescript/plugin.js +14 -9
- package/dist/src/release/version-actions.js +4 -2
- package/dist/src/utils/generate-globs.js +6 -1
- package/dist/src/utils/npm-config.d.ts +2 -2
- package/dist/src/utils/npm-config.js +20 -10
- package/package.json +13 -13
|
@@ -155,18 +155,15 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
155
155
|
registry: options.registry,
|
|
156
156
|
tag: options.tag,
|
|
157
157
|
}, warnFn);
|
|
158
|
+
const registryArgs = registry ? [`--${registryConfigKey}=${registry}`] : [];
|
|
159
|
+
const registryLabel = describeRegistry(registry, registryConfigKey);
|
|
158
160
|
// Use bun info when bun is the package manager, otherwise use npm view
|
|
159
161
|
// (npm view works across npm/pnpm/yarn environments and is the established default)
|
|
160
162
|
const npmViewDistTagField = `dist-tags[${tag}]`;
|
|
161
163
|
const npmViewCommand = pm === 'bun'
|
|
162
164
|
? {
|
|
163
165
|
command: 'bun',
|
|
164
|
-
args: [
|
|
165
|
-
'info',
|
|
166
|
-
packageName,
|
|
167
|
-
'--json',
|
|
168
|
-
`--${registryConfigKey}=${registry}`,
|
|
169
|
-
],
|
|
166
|
+
args: ['info', packageName, '--json', ...registryArgs],
|
|
170
167
|
}
|
|
171
168
|
: {
|
|
172
169
|
command: 'npm',
|
|
@@ -177,7 +174,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
177
174
|
'version',
|
|
178
175
|
npmViewDistTagField,
|
|
179
176
|
'--json',
|
|
180
|
-
|
|
177
|
+
...registryArgs,
|
|
181
178
|
],
|
|
182
179
|
};
|
|
183
180
|
const npmDistTagAddCommand = {
|
|
@@ -187,7 +184,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
187
184
|
'add',
|
|
188
185
|
`${packageName}@${packageJson.version}`,
|
|
189
186
|
tag,
|
|
190
|
-
|
|
187
|
+
...registryArgs,
|
|
191
188
|
],
|
|
192
189
|
};
|
|
193
190
|
/**
|
|
@@ -240,7 +237,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
240
237
|
}
|
|
241
238
|
}
|
|
242
239
|
if (distTagVersion === currentVersion) {
|
|
243
|
-
console.warn(`Skipped ${packageTxt} because v${currentVersion} already exists in ${
|
|
240
|
+
console.warn(`Skipped ${packageTxt} because v${currentVersion} already exists in ${registryLabel} with tag "${tag}"`);
|
|
244
241
|
return {
|
|
245
242
|
success: true,
|
|
246
243
|
};
|
|
@@ -254,10 +251,10 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
254
251
|
cwd: context.root,
|
|
255
252
|
stdio: 'ignore',
|
|
256
253
|
});
|
|
257
|
-
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${
|
|
254
|
+
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registryLabel}.\n`);
|
|
258
255
|
}
|
|
259
256
|
else {
|
|
260
|
-
console.log(`Would add the dist-tag ${tag} to v${currentVersion} for registry ${
|
|
257
|
+
console.log(`Would add the dist-tag ${tag} to v${currentVersion} for registry ${registryLabel}, but ${chalk.keyword('orange')('[dry-run]')} was set.\n`);
|
|
261
258
|
}
|
|
262
259
|
return {
|
|
263
260
|
success: true,
|
|
@@ -340,8 +337,12 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
340
337
|
packageTxt,
|
|
341
338
|
});
|
|
342
339
|
}
|
|
340
|
+
function describeRegistry(registry, registryConfigKey) {
|
|
341
|
+
return registry ?? `the configured ${registryConfigKey}`;
|
|
342
|
+
}
|
|
343
343
|
function runPublish(ctx) {
|
|
344
344
|
const { pm, options, context, packageRoot, packageJson, registry, registryConfigKey, tag, isDryRun, isNpmInstalled, packageTxt, } = ctx;
|
|
345
|
+
const registryLabel = describeRegistry(registry, registryConfigKey);
|
|
345
346
|
const pmCommand = (0, devkit_1.getPackageManagerCommand)(pm);
|
|
346
347
|
const { command: publishCommand, args: publishArgs } = pmCommand.publishArgv(packageRoot, registry, registryConfigKey, tag);
|
|
347
348
|
if (options.otp) {
|
|
@@ -363,8 +364,8 @@ function runPublish(ctx) {
|
|
|
363
364
|
// If in dry-run mode, the version on disk will not represent the version that would be published, so we scrub it from the output to avoid confusion.
|
|
364
365
|
const dryRunVersionPlaceholder = 'X.X.X-dry-run';
|
|
365
366
|
const publishSummaryMessage = isDryRun
|
|
366
|
-
? `Would publish to ${
|
|
367
|
-
: `Published to ${
|
|
367
|
+
? `Would publish to ${registryLabel} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`
|
|
368
|
+
: `Published to ${registryLabel} with tag "${tag}"`;
|
|
368
369
|
// bun publish does not support outputting JSON, so we need to modify and print the output string directly
|
|
369
370
|
if (pm === 'bun') {
|
|
370
371
|
let outputStr = output;
|
|
@@ -456,7 +457,7 @@ function runPublish(ctx) {
|
|
|
456
457
|
const stderr = err.stderr?.toString() || '';
|
|
457
458
|
const stdout = err.stdout?.toString() || '';
|
|
458
459
|
if (isAlreadyPublishedPublishError(undefined, stderr, stdout)) {
|
|
459
|
-
console.warn(`Skipped ${packageTxt}, as v${packageJson.version} has already been published to ${
|
|
460
|
+
console.warn(`Skipped ${packageTxt}, as v${packageJson.version} has already been published to ${registryLabel} with tag "${tag}"`);
|
|
460
461
|
return {
|
|
461
462
|
success: true,
|
|
462
463
|
};
|
|
@@ -468,7 +469,7 @@ function runPublish(ctx) {
|
|
|
468
469
|
};
|
|
469
470
|
}
|
|
470
471
|
if (isAlreadyPublishedPublishError(stdoutData, err.stderr?.toString() || '', err.stdout?.toString() || '')) {
|
|
471
|
-
console.warn(`Skipped ${packageTxt}, as v${packageJson.version} has already been published to ${
|
|
472
|
+
console.warn(`Skipped ${packageTxt}, as v${packageJson.version} has already been published to ${registryLabel} with tag "${tag}"`);
|
|
472
473
|
return {
|
|
473
474
|
success: true,
|
|
474
475
|
};
|
|
@@ -101,8 +101,9 @@ async function syncGenerator(tree) {
|
|
|
101
101
|
}
|
|
102
102
|
if (changedFiles.size > 0) {
|
|
103
103
|
const updatedReferences = Array.from(referencesSet)
|
|
104
|
-
// Check composite is true in the internal reference before proceeding
|
|
105
|
-
|
|
104
|
+
// Check composite is true in the internal reference before proceeding.
|
|
105
|
+
// A reference can name a tsconfig file directly rather than a directory.
|
|
106
|
+
.filter((ref) => hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, toFullProjectReferencePath(ref)))
|
|
106
107
|
.map((ref) => ({
|
|
107
108
|
path: `./${ref}`,
|
|
108
109
|
}));
|
|
@@ -22,7 +22,7 @@ function resolveTypescriptPath(projectRoot, workspaceRoot) {
|
|
|
22
22
|
});
|
|
23
23
|
return resolvedTypescriptPaths[projectRoot];
|
|
24
24
|
}
|
|
25
|
-
const TSCONFIG_CACHE_VERSION =
|
|
25
|
+
const TSCONFIG_CACHE_VERSION = 3;
|
|
26
26
|
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(internal_1.workspaceDataDirectory, 'tsconfig-files.hash');
|
|
27
27
|
// Module-level cache store — each invocation gets a unique Symbol key
|
|
28
28
|
const cacheStore = new Map();
|
|
@@ -1106,16 +1106,17 @@ function toAbsolutePaths(cache, workspaceRoot) {
|
|
|
1106
1106
|
extendedFilesHash,
|
|
1107
1107
|
hash,
|
|
1108
1108
|
};
|
|
1109
|
-
|
|
1109
|
+
// '' is a valid cached path (the workspace root), so check for undefined
|
|
1110
|
+
if (data.options.rootDir !== undefined) {
|
|
1110
1111
|
updatedCache[key].data.options.rootDir = (0, node_path_1.join)(workspaceRoot, data.options.rootDir);
|
|
1111
1112
|
}
|
|
1112
|
-
if (data.options.outDir) {
|
|
1113
|
+
if (data.options.outDir !== undefined) {
|
|
1113
1114
|
updatedCache[key].data.options.outDir = (0, node_path_1.join)(workspaceRoot, data.options.outDir);
|
|
1114
1115
|
}
|
|
1115
|
-
if (data.options.outFile) {
|
|
1116
|
+
if (data.options.outFile !== undefined) {
|
|
1116
1117
|
updatedCache[key].data.options.outFile = (0, node_path_1.join)(workspaceRoot, data.options.outFile);
|
|
1117
1118
|
}
|
|
1118
|
-
if (data.options.tsBuildInfoFile) {
|
|
1119
|
+
if (data.options.tsBuildInfoFile !== undefined) {
|
|
1119
1120
|
updatedCache[key].data.options.tsBuildInfoFile = (0, node_path_1.join)(workspaceRoot, data.options.tsBuildInfoFile);
|
|
1120
1121
|
}
|
|
1121
1122
|
if (data.extendedConfigFiles.length) {
|
|
@@ -1160,16 +1161,16 @@ function toRelativePaths(cache, workspaceRoot) {
|
|
|
1160
1161
|
hash,
|
|
1161
1162
|
};
|
|
1162
1163
|
if (data.options.rootDir) {
|
|
1163
|
-
updatedCache[key].data.options.rootDir =
|
|
1164
|
+
updatedCache[key].data.options.rootDir = toCachedPath(workspaceRoot, data.options.rootDir);
|
|
1164
1165
|
}
|
|
1165
1166
|
if (data.options.outDir) {
|
|
1166
|
-
updatedCache[key].data.options.outDir =
|
|
1167
|
+
updatedCache[key].data.options.outDir = toCachedPath(workspaceRoot, data.options.outDir);
|
|
1167
1168
|
}
|
|
1168
1169
|
if (data.options.outFile) {
|
|
1169
|
-
updatedCache[key].data.options.outFile =
|
|
1170
|
+
updatedCache[key].data.options.outFile = toCachedPath(workspaceRoot, data.options.outFile);
|
|
1170
1171
|
}
|
|
1171
1172
|
if (data.options.tsBuildInfoFile) {
|
|
1172
|
-
updatedCache[key].data.options.tsBuildInfoFile =
|
|
1173
|
+
updatedCache[key].data.options.tsBuildInfoFile = toCachedPath(workspaceRoot, data.options.tsBuildInfoFile);
|
|
1173
1174
|
}
|
|
1174
1175
|
if (data.extendedConfigFiles.length) {
|
|
1175
1176
|
updatedCache[key].data.extendedConfigFiles.forEach((file) => {
|
|
@@ -1188,3 +1189,7 @@ function toRelativePaths(cache, workspaceRoot) {
|
|
|
1188
1189
|
function posixRelative(workspaceRoot, path) {
|
|
1189
1190
|
return (0, devkit_1.normalizePath)((0, node_path_1.relative)(workspaceRoot, path));
|
|
1190
1191
|
}
|
|
1192
|
+
// relative() returns '' for the workspace root, which is falsy like an unset option
|
|
1193
|
+
function toCachedPath(workspaceRoot, path) {
|
|
1194
|
+
return posixRelative(workspaceRoot, path) || '.';
|
|
1195
|
+
}
|
|
@@ -72,7 +72,7 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
72
72
|
'view',
|
|
73
73
|
packageName,
|
|
74
74
|
'version',
|
|
75
|
-
`--${registryConfigKey}=${registry}
|
|
75
|
+
...(registry ? [`--${registryConfigKey}=${registry}`] : []),
|
|
76
76
|
`--tag=${tag}`,
|
|
77
77
|
], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
78
78
|
let stdout = '';
|
|
@@ -105,7 +105,9 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
105
105
|
return {
|
|
106
106
|
currentVersion,
|
|
107
107
|
// Make troubleshooting easier by including the registry and tag data in the log text
|
|
108
|
-
logText:
|
|
108
|
+
logText: registry
|
|
109
|
+
? `"${registryConfigKey}=${registry}" tag=${tag}`
|
|
110
|
+
: `the configured "${registryConfigKey}" tag=${tag}`,
|
|
109
111
|
};
|
|
110
112
|
}
|
|
111
113
|
async readCurrentVersionOfDependency(tree, projectGraph, dependencyProjectName) {
|
|
@@ -69,7 +69,12 @@ ${warnings.join('\n- ')}\n
|
|
|
69
69
|
due to missing "sourceRoot" in the dependencies' project configuration
|
|
70
70
|
`);
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
// A dependency whose sourceRoot is its project root would otherwise scan its
|
|
73
|
+
// node_modules, where pnpm workspace symlinks fan out across the repo.
|
|
74
|
+
return [
|
|
75
|
+
...dirsToUse.map((sourceDir) => (0, path_1.resolve)(devkit_1.workspaceRoot, (0, devkit_1.joinPathFragments)(sourceDir, fileGlobPattern))),
|
|
76
|
+
...dirsToUse.map((sourceDir) => `!${(0, path_1.resolve)(devkit_1.workspaceRoot, (0, devkit_1.joinPathFragments)(sourceDir, '**/node_modules/**'))}`),
|
|
77
|
+
];
|
|
73
78
|
}
|
|
74
79
|
catch (e) {
|
|
75
80
|
throw new Error(`createGlobPatternsForDependencies: Error when generating globs.\n${e?.message}`);
|
|
@@ -6,7 +6,7 @@ export declare function parseRegistryOptions(cwd: string, pkg: {
|
|
|
6
6
|
registry?: string;
|
|
7
7
|
tag?: string;
|
|
8
8
|
}, logWarnFn?: (message: string) => void): Promise<{
|
|
9
|
-
registry: string;
|
|
9
|
+
registry: string | undefined;
|
|
10
10
|
tag: string;
|
|
11
11
|
registryConfigKey: string;
|
|
12
12
|
}>;
|
|
@@ -16,7 +16,7 @@ export declare function parseRegistryOptions(cwd: string, pkg: {
|
|
|
16
16
|
* @param scope the scope of the package for which to determine the registry
|
|
17
17
|
* @param cwd the directory where the npm config should be read from
|
|
18
18
|
*/
|
|
19
|
-
export declare function getNpmRegistry(cwd: string, scope?: string): Promise<string>;
|
|
19
|
+
export declare function getNpmRegistry(cwd: string, scope?: string): Promise<string | undefined>;
|
|
20
20
|
/**
|
|
21
21
|
* Returns the npm tag that is used for publishing.
|
|
22
22
|
*
|
|
@@ -46,14 +46,21 @@ async function parseRegistryOptions(cwd, pkg, options, logWarnFn = console.warn)
|
|
|
46
46
|
* @param cwd the directory where the npm config should be read from
|
|
47
47
|
*/
|
|
48
48
|
async function getNpmRegistry(cwd, scope) {
|
|
49
|
-
let registry;
|
|
50
49
|
if (scope) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
let scopedRegistry;
|
|
51
|
+
try {
|
|
52
|
+
scopedRegistry = await readNpmConfigValue(`${scope}:registry`, cwd);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// npm refuses to print values it would redact, so the scope may still
|
|
56
|
+
// have a registry. Falling back to the unscoped one would override it.
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (scopedRegistry) {
|
|
60
|
+
return scopedRegistry;
|
|
61
|
+
}
|
|
55
62
|
}
|
|
56
|
-
return registry;
|
|
63
|
+
return getNpmConfigValue('registry', cwd);
|
|
57
64
|
}
|
|
58
65
|
/**
|
|
59
66
|
* Returns the npm tag that is used for publishing.
|
|
@@ -66,13 +73,16 @@ async function getNpmTag(cwd) {
|
|
|
66
73
|
}
|
|
67
74
|
async function getNpmConfigValue(key, cwd) {
|
|
68
75
|
try {
|
|
69
|
-
|
|
70
|
-
return result === 'undefined' ? undefined : result;
|
|
76
|
+
return await readNpmConfigValue(key, cwd);
|
|
71
77
|
}
|
|
72
|
-
catch
|
|
73
|
-
return
|
|
78
|
+
catch {
|
|
79
|
+
return undefined;
|
|
74
80
|
}
|
|
75
81
|
}
|
|
82
|
+
async function readNpmConfigValue(key, cwd) {
|
|
83
|
+
const result = await npmConfigGet(key, cwd);
|
|
84
|
+
return result === 'undefined' ? undefined : result;
|
|
85
|
+
}
|
|
76
86
|
// `key` carries the package's own scope, so it goes to npm as an argument
|
|
77
87
|
// rather than through a shell.
|
|
78
88
|
async function npmConfigGet(key, cwd) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "24.0.
|
|
3
|
+
"version": "24.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
"@babel/preset-env": "^7.23.2",
|
|
163
163
|
"@babel/preset-typescript": "^7.22.5",
|
|
164
164
|
"@babel/runtime": "^7.22.6",
|
|
165
|
-
"@nx/devkit": "24.0.
|
|
166
|
-
"@nx/workspace": "24.0.
|
|
165
|
+
"@nx/devkit": "24.0.4",
|
|
166
|
+
"@nx/workspace": "24.0.4",
|
|
167
167
|
"@zkochan/js-yaml": "0.0.7",
|
|
168
168
|
"babel-plugin-const-enum": "^1.0.1",
|
|
169
169
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -176,21 +176,21 @@
|
|
|
176
176
|
"jsonc-parser": "^3.2.0",
|
|
177
177
|
"npm-run-path": "^4.0.1",
|
|
178
178
|
"picocolors": "^1.1.0",
|
|
179
|
-
"picomatch": "4.0.
|
|
179
|
+
"picomatch": "^4.0.7",
|
|
180
180
|
"semver": "^7.6.3",
|
|
181
|
-
"source-map-support": "0.5.
|
|
181
|
+
"source-map-support": "0.5.21",
|
|
182
182
|
"tinyglobby": "^0.2.12",
|
|
183
183
|
"tslib": "^2.3.0"
|
|
184
184
|
},
|
|
185
185
|
"devDependencies": {
|
|
186
|
-
"@nx/esbuild": "24.0.
|
|
187
|
-
"@nx/eslint": "24.0.
|
|
188
|
-
"@nx/jest": "24.0.
|
|
189
|
-
"@nx/oxlint": "24.0.
|
|
190
|
-
"@nx/rollup": "24.0.
|
|
191
|
-
"@nx/vite": "24.0.
|
|
192
|
-
"@nx/vitest": "24.0.
|
|
193
|
-
"nx": "24.0.
|
|
186
|
+
"@nx/esbuild": "24.0.4",
|
|
187
|
+
"@nx/eslint": "24.0.4",
|
|
188
|
+
"@nx/jest": "24.0.4",
|
|
189
|
+
"@nx/oxlint": "24.0.4",
|
|
190
|
+
"@nx/rollup": "24.0.4",
|
|
191
|
+
"@nx/vite": "24.0.4",
|
|
192
|
+
"@nx/vitest": "24.0.4",
|
|
193
|
+
"nx": "24.0.4"
|
|
194
194
|
},
|
|
195
195
|
"peerDependencies": {
|
|
196
196
|
"@swc/cli": ">=0.6.0 <0.9.0",
|