@nx/js 18.0.7 → 18.0.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "^7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "18.0.
|
|
61
|
-
"@nx/workspace": "18.0.
|
|
62
|
-
"@nrwl/js": "18.0.
|
|
60
|
+
"@nx/devkit": "18.0.8",
|
|
61
|
+
"@nx/workspace": "18.0.8",
|
|
62
|
+
"@nrwl/js": "18.0.8"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.releaseVersionGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
|
-
const
|
|
6
|
+
const node_child_process_1 = require("node:child_process");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
7
8
|
const config_1 = require("nx/src/command-line/release/config/config");
|
|
8
9
|
const git_1 = require("nx/src/command-line/release/utils/git");
|
|
9
10
|
const resolve_semver_specifier_1 = require("nx/src/command-line/release/utils/resolve-semver-specifier");
|
|
@@ -11,7 +12,6 @@ const semver_1 = require("nx/src/command-line/release/utils/semver");
|
|
|
11
12
|
const version_1 = require("nx/src/command-line/release/version");
|
|
12
13
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
13
14
|
const ora = require("ora");
|
|
14
|
-
const path_1 = require("path");
|
|
15
15
|
const semver_2 = require("semver");
|
|
16
16
|
const resolve_local_package_dependencies_1 = require("./utils/resolve-local-package-dependencies");
|
|
17
17
|
const update_lock_file_1 = require("./utils/update-lock-file");
|
|
@@ -39,36 +39,30 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
|
39
39
|
options.fallbackCurrentVersionResolver = 'disk';
|
|
40
40
|
}
|
|
41
41
|
const projects = options.projects;
|
|
42
|
-
const createResolvePackageRoot = (customPackageRoot) => (projectNode) => {
|
|
43
|
-
// Default to the project root if no custom packageRoot
|
|
44
|
-
if (!customPackageRoot) {
|
|
45
|
-
return projectNode.data.root;
|
|
46
|
-
}
|
|
47
|
-
return (0, utils_1.interpolate)(customPackageRoot, {
|
|
48
|
-
workspaceRoot: '',
|
|
49
|
-
projectRoot: projectNode.data.root,
|
|
50
|
-
projectName: projectNode.name,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
42
|
const resolvePackageRoot = createResolvePackageRoot(options.packageRoot);
|
|
54
43
|
// Resolve any custom package roots for each project upfront as they will need to be reused during dependency resolution
|
|
55
44
|
const projectNameToPackageRootMap = new Map();
|
|
56
45
|
for (const project of projects) {
|
|
57
46
|
projectNameToPackageRootMap.set(project.name, resolvePackageRoot(project));
|
|
58
47
|
}
|
|
59
|
-
let currentVersion;
|
|
48
|
+
let currentVersion = undefined;
|
|
60
49
|
let currentVersionResolvedFromFallback = false;
|
|
61
50
|
// only used for options.currentVersionResolver === 'git-tag', but
|
|
62
51
|
// must be declared here in order to reuse it for additional projects
|
|
63
|
-
let latestMatchingGitTag;
|
|
52
|
+
let latestMatchingGitTag = undefined;
|
|
64
53
|
// if specifier is undefined, then we haven't resolved it yet
|
|
65
54
|
// if specifier is null, then it has been resolved and no changes are necessary
|
|
66
|
-
let specifier = options.specifier
|
|
55
|
+
let specifier = options.specifier
|
|
56
|
+
? options.specifier
|
|
57
|
+
: undefined;
|
|
67
58
|
for (const project of projects) {
|
|
68
59
|
const projectName = project.name;
|
|
69
60
|
const packageRoot = projectNameToPackageRootMap.get(projectName);
|
|
61
|
+
if (!packageRoot) {
|
|
62
|
+
throw new Error(`The project "${projectName}" does not have a packageRoot available. Please report this issue on https://github.com/nrwl/nx`);
|
|
63
|
+
}
|
|
70
64
|
const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
|
|
71
|
-
const workspaceRelativePackageJsonPath = (0,
|
|
65
|
+
const workspaceRelativePackageJsonPath = (0, node_path_1.relative)(devkit_1.workspaceRoot, packageJsonPath);
|
|
72
66
|
const color = getColor(projectName);
|
|
73
67
|
const log = (msg) => {
|
|
74
68
|
console.log(color.instance.bold(projectName) + ' ' + msg);
|
|
@@ -102,7 +96,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
102
96
|
try {
|
|
103
97
|
// Must be non-blocking async to allow spinner to render
|
|
104
98
|
currentVersion = await new Promise((resolve, reject) => {
|
|
105
|
-
(0,
|
|
99
|
+
(0, node_child_process_1.exec)(`npm view ${packageName} version --registry=${registry} --tag=${tag}`, (error, stdout, stderr) => {
|
|
106
100
|
if (error) {
|
|
107
101
|
return reject(error);
|
|
108
102
|
}
|
|
@@ -169,7 +163,9 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
169
163
|
log(`📄 Using the current version ${currentVersion} already resolved from disk fallback.`);
|
|
170
164
|
}
|
|
171
165
|
else {
|
|
172
|
-
log(
|
|
166
|
+
log(
|
|
167
|
+
// In this code path we know that latestMatchingGitTag is defined, because we are not relying on the fallbackCurrentVersionResolver, so we can safely use the non-null assertion operator
|
|
168
|
+
`📄 Using the current version ${currentVersion} already resolved from git tag "${latestMatchingGitTag.tag}".`);
|
|
173
169
|
}
|
|
174
170
|
}
|
|
175
171
|
break;
|
|
@@ -195,7 +191,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
195
191
|
!options.specifier)) {
|
|
196
192
|
const specifierSource = options.specifierSource;
|
|
197
193
|
switch (specifierSource) {
|
|
198
|
-
case 'conventional-commits':
|
|
194
|
+
case 'conventional-commits': {
|
|
199
195
|
if (options.currentVersionResolver !== 'git-tag') {
|
|
200
196
|
throw new Error(`Invalid currentVersionResolver "${options.currentVersionResolver}" provided for release group "${options.releaseGroup.name}". Must be "git-tag" when "specifierSource" is "conventional-commits"`);
|
|
201
197
|
}
|
|
@@ -222,7 +218,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
222
218
|
//
|
|
223
219
|
// Always assume that if the current version is a prerelease, then the next version should be a prerelease.
|
|
224
220
|
// Users must manually graduate from a prerelease to a release by providing an explicit specifier.
|
|
225
|
-
if ((0, semver_2.prerelease)(currentVersion)) {
|
|
221
|
+
if ((0, semver_2.prerelease)(currentVersion ?? '')) {
|
|
226
222
|
specifier = 'prerelease';
|
|
227
223
|
log(`📄 Resolved the specifier as "${specifier}" since the current version is a prerelease.`);
|
|
228
224
|
}
|
|
@@ -230,6 +226,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
230
226
|
log(`📄 Resolved the specifier as "${specifier}" using git history and the conventional commits standard.`);
|
|
231
227
|
}
|
|
232
228
|
break;
|
|
229
|
+
}
|
|
233
230
|
case 'prompt': {
|
|
234
231
|
// Only add the release group name to the log if it is one set by the user, otherwise it is useless noise
|
|
235
232
|
const maybeLogReleaseGroup = (log) => {
|
|
@@ -259,9 +256,13 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
259
256
|
.filter((localPackageDependency) => {
|
|
260
257
|
return localPackageDependency.target === project.name;
|
|
261
258
|
});
|
|
259
|
+
if (!currentVersion) {
|
|
260
|
+
throw new Error(`The current version for project "${project.name}" could not be resolved. Please report this on https://github.com/nrwl/nx`);
|
|
261
|
+
}
|
|
262
262
|
versionData[projectName] = {
|
|
263
263
|
currentVersion,
|
|
264
264
|
dependentProjects,
|
|
265
|
+
// @ts-ignore: The types will be updated in a future version of Nx
|
|
265
266
|
newVersion: null, // will stay as null in the final result in the case that no changes are detected
|
|
266
267
|
};
|
|
267
268
|
if (!specifier) {
|
|
@@ -281,7 +282,11 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
281
282
|
: 'package which depends'} on ${project.name}`);
|
|
282
283
|
}
|
|
283
284
|
for (const dependentProject of dependentProjects) {
|
|
284
|
-
|
|
285
|
+
const dependentPackageRoot = projectNameToPackageRootMap.get(dependentProject.source);
|
|
286
|
+
if (!dependentPackageRoot) {
|
|
287
|
+
throw new Error(`The dependent project "${dependentProject.source}" does not have a packageRoot available. Please report this issue on https://github.com/nrwl/nx`);
|
|
288
|
+
}
|
|
289
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(dependentPackageRoot, 'package.json'), (json) => {
|
|
285
290
|
// Auto (i.e.infer existing) by default
|
|
286
291
|
let versionPrefix = options.versionPrefix ?? 'auto';
|
|
287
292
|
// For auto, we infer the prefix based on the current version of the dependent
|
|
@@ -304,7 +309,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
311
|
/**
|
|
307
|
-
* Ensure that formatting is applied so that version bump diffs are as
|
|
312
|
+
* Ensure that formatting is applied so that version bump diffs are as minimal as possible
|
|
308
313
|
* within the context of the user's workspace.
|
|
309
314
|
*/
|
|
310
315
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -336,6 +341,19 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
336
341
|
}
|
|
337
342
|
exports.releaseVersionGenerator = releaseVersionGenerator;
|
|
338
343
|
exports.default = releaseVersionGenerator;
|
|
344
|
+
function createResolvePackageRoot(customPackageRoot) {
|
|
345
|
+
return (projectNode) => {
|
|
346
|
+
// Default to the project root if no custom packageRoot
|
|
347
|
+
if (!customPackageRoot) {
|
|
348
|
+
return projectNode.data.root;
|
|
349
|
+
}
|
|
350
|
+
return (0, utils_1.interpolate)(customPackageRoot, {
|
|
351
|
+
workspaceRoot: '',
|
|
352
|
+
projectRoot: projectNode.data.root,
|
|
353
|
+
projectName: projectNode.name,
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
}
|
|
339
357
|
const colors = [
|
|
340
358
|
{ instance: chalk.green, spinnerColor: 'green' },
|
|
341
359
|
{ instance: chalk.greenBright, spinnerColor: 'green' },
|
|
@@ -359,7 +377,7 @@ function getColor(projectName) {
|
|
|
359
377
|
async function getNpmRegistry() {
|
|
360
378
|
// Must be non-blocking async to allow spinner to render
|
|
361
379
|
return await new Promise((resolve, reject) => {
|
|
362
|
-
(0,
|
|
380
|
+
(0, node_child_process_1.exec)('npm config get registry', (error, stdout, stderr) => {
|
|
363
381
|
if (error) {
|
|
364
382
|
return reject(error);
|
|
365
383
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ProjectGraph, ProjectGraphDependency, ProjectGraphProjectNode, Tree } from '@nx/devkit';
|
|
2
2
|
interface LocalPackageDependency extends ProjectGraphDependency {
|
|
3
|
+
/**
|
|
4
|
+
* The rawVersionSpec contains the value of the version spec as it was defined in the package.json
|
|
5
|
+
* of the dependent project. This can be useful in cases where the version spec is a range, path or
|
|
6
|
+
* workspace reference, and it needs to be be reverted to that original value as part of the release.
|
|
7
|
+
*/
|
|
8
|
+
rawVersionSpec: string;
|
|
3
9
|
dependencyCollection: 'dependencies' | 'devDependencies' | 'optionalDependencies';
|
|
4
10
|
}
|
|
5
11
|
export declare function resolveLocalPackageDependencies(tree: Tree, projectGraph: ProjectGraph, filteredProjects: ProjectGraphProjectNode[], projectNameToPackageRootMap: Map<string, string>, resolvePackageRoot: (projectNode: ProjectGraphProjectNode) => string, includeAll?: boolean): Record<string, LocalPackageDependency[]>;
|