@nx/js 17.3.0-rc.0 → 17.3.0
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 +4 -4
- package/src/generators/release-version/release-version.js +3 -23
- package/src/generators/release-version/utils/update-lock-file.d.ts +1 -1
- package/src/generators/release-version/utils/update-lock-file.js +21 -1
- package/src/utils/buildable-libs-utils.js +5 -1
- package/src/utils/typescript/ts-config.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "17.3.0
|
|
3
|
+
"version": "17.3.0",
|
|
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": "17.3.0
|
|
61
|
-
"@nx/workspace": "17.3.0
|
|
62
|
-
"@nrwl/js": "17.3.0
|
|
60
|
+
"@nx/devkit": "17.3.0",
|
|
61
|
+
"@nx/workspace": "17.3.0",
|
|
62
|
+
"@nrwl/js": "17.3.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -9,7 +9,6 @@ const git_1 = require("nx/src/command-line/release/utils/git");
|
|
|
9
9
|
const resolve_semver_specifier_1 = require("nx/src/command-line/release/utils/resolve-semver-specifier");
|
|
10
10
|
const semver_1 = require("nx/src/command-line/release/utils/semver");
|
|
11
11
|
const version_1 = require("nx/src/command-line/release/version");
|
|
12
|
-
const client_1 = require("nx/src/daemon/client/client");
|
|
13
12
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
14
13
|
const ora = require("ora");
|
|
15
14
|
const path_1 = require("path");
|
|
@@ -124,7 +123,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
124
123
|
currentVersionResolvedFromFallback = true;
|
|
125
124
|
}
|
|
126
125
|
else {
|
|
127
|
-
throw new Error(`Unable to resolve the current version from the registry ${registry}. Please ensure that the package exists in the registry in order to use the "registry" currentVersionResolver. Alternatively, you can use the --first-release option or set "version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when the registry lookup fails.`);
|
|
126
|
+
throw new Error(`Unable to resolve the current version from the registry ${registry}. Please ensure that the package exists in the registry in order to use the "registry" currentVersionResolver. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when the registry lookup fails.`);
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}
|
|
@@ -157,7 +156,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
157
156
|
currentVersionResolvedFromFallback = true;
|
|
158
157
|
}
|
|
159
158
|
else {
|
|
160
|
-
throw new Error(`No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found.`);
|
|
159
|
+
throw new Error(`No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found.`);
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
else {
|
|
@@ -314,26 +313,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
314
313
|
data: versionData,
|
|
315
314
|
callback: async (tree, opts) => {
|
|
316
315
|
const cwd = tree.root;
|
|
317
|
-
const
|
|
318
|
-
if (isDaemonEnabled) {
|
|
319
|
-
// temporarily stop the daemon, as it will error if the lock file is updated
|
|
320
|
-
await client_1.daemonClient.stop();
|
|
321
|
-
}
|
|
322
|
-
const updatedFiles = (0, update_lock_file_1.updateLockFile)(cwd, opts);
|
|
323
|
-
if (isDaemonEnabled) {
|
|
324
|
-
try {
|
|
325
|
-
await client_1.daemonClient.startInBackground();
|
|
326
|
-
}
|
|
327
|
-
catch (e) {
|
|
328
|
-
// If the daemon fails to start, we don't want to prevent the user from continuing, so we just log the error and move on
|
|
329
|
-
if (opts.verbose) {
|
|
330
|
-
devkit_1.output.warn({
|
|
331
|
-
title: 'Unable to restart the Nx Daemon. It will be disabled until you run "nx reset"',
|
|
332
|
-
bodyLines: [e.message],
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
316
|
+
const updatedFiles = await (0, update_lock_file_1.updateLockFile)(cwd, opts);
|
|
337
317
|
return updatedFiles;
|
|
338
318
|
},
|
|
339
319
|
};
|
|
@@ -3,16 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateLockFile = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
|
+
const client_1 = require("nx/src/daemon/client/client");
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
7
8
|
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
8
9
|
const semver_1 = require("semver");
|
|
9
|
-
function updateLockFile(cwd, { dryRun, verbose, generatorOptions, }) {
|
|
10
|
+
async function updateLockFile(cwd, { dryRun, verbose, generatorOptions, }) {
|
|
10
11
|
if (generatorOptions?.skipLockFileUpdate) {
|
|
11
12
|
if (verbose) {
|
|
12
13
|
console.log('\nSkipped lock file update because skipLockFileUpdate was set.');
|
|
13
14
|
}
|
|
14
15
|
return [];
|
|
15
16
|
}
|
|
17
|
+
const isDaemonEnabled = client_1.daemonClient.enabled();
|
|
18
|
+
if (isDaemonEnabled) {
|
|
19
|
+
// temporarily stop the daemon, as it will error if the lock file is updated
|
|
20
|
+
await client_1.daemonClient.stop();
|
|
21
|
+
}
|
|
16
22
|
const packageManager = (0, devkit_1.detectPackageManager)(cwd);
|
|
17
23
|
const packageManagerCommands = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
18
24
|
let installArgs = generatorOptions?.installArgs || '';
|
|
@@ -43,6 +49,20 @@ function updateLockFile(cwd, { dryRun, verbose, generatorOptions, }) {
|
|
|
43
49
|
return [];
|
|
44
50
|
}
|
|
45
51
|
execLockFileUpdate(command, cwd, env);
|
|
52
|
+
if (isDaemonEnabled) {
|
|
53
|
+
try {
|
|
54
|
+
await client_1.daemonClient.startInBackground();
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
// If the daemon fails to start, we don't want to prevent the user from continuing, so we just log the error and move on
|
|
58
|
+
if (verbose) {
|
|
59
|
+
devkit_1.output.warn({
|
|
60
|
+
title: 'Unable to restart the Nx Daemon. It will be disabled until you run "nx reset"',
|
|
61
|
+
bodyLines: [e.message],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
46
66
|
return [lockFile];
|
|
47
67
|
}
|
|
48
68
|
exports.updateLockFile = updateLockFile;
|
|
@@ -84,7 +84,8 @@ function calculateProjectDependencies(projGraph, root, projectName, targetName,
|
|
|
84
84
|
exports.calculateProjectDependencies = calculateProjectDependencies;
|
|
85
85
|
function collectDependencies(project, projGraph, acc, shallow, areTopLevelDeps = true) {
|
|
86
86
|
(projGraph.dependencies[project] || []).forEach((dependency) => {
|
|
87
|
-
|
|
87
|
+
const existingEntry = acc.find((dep) => dep.name === dependency.target);
|
|
88
|
+
if (!existingEntry) {
|
|
88
89
|
// Temporary skip this. Currently the set of external nodes is built from package.json, not lock file.
|
|
89
90
|
// As a result, some nodes might be missing. This should not cause any issues, we can just skip them.
|
|
90
91
|
if (dependency.target.startsWith('npm:') &&
|
|
@@ -96,6 +97,9 @@ function collectDependencies(project, projGraph, acc, shallow, areTopLevelDeps =
|
|
|
96
97
|
collectDependencies(dependency.target, projGraph, acc, shallow, false);
|
|
97
98
|
}
|
|
98
99
|
}
|
|
100
|
+
else if (areTopLevelDeps && !existingEntry.isTopLevel) {
|
|
101
|
+
existingEntry.isTopLevel = true;
|
|
102
|
+
}
|
|
99
103
|
});
|
|
100
104
|
return acc;
|
|
101
105
|
}
|
|
@@ -46,6 +46,7 @@ function getRootTsConfigFileName(tree) {
|
|
|
46
46
|
exports.getRootTsConfigFileName = getRootTsConfigFileName;
|
|
47
47
|
function addTsConfigPath(tree, importPath, lookupPaths) {
|
|
48
48
|
(0, devkit_1.updateJson)(tree, getRootTsConfigPathInTree(tree), (json) => {
|
|
49
|
+
json.compilerOptions ??= {};
|
|
49
50
|
const c = json.compilerOptions;
|
|
50
51
|
c.paths ??= {};
|
|
51
52
|
if (c.paths[importPath]) {
|