nx 19.0.0-canary.20240502-5ded713 → 19.0.0-canary.20240504-fd5ea92
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 +12 -12
- package/src/command-line/add/add.d.ts +1 -0
- package/src/command-line/add/add.js +13 -33
- package/src/command-line/graph/graph.js +27 -3
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +1 -0
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -20
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/generators/utils/project-configuration.js +1 -6
- package/src/plugins/package-json-workspaces/create-nodes.d.ts +1 -0
- package/src/plugins/package-json-workspaces/create-nodes.js +23 -18
- package/src/project-graph/build-project-graph.js +29 -4
- package/src/project-graph/error-types.d.ts +27 -8
- package/src/project-graph/error-types.js +66 -10
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -0
- package/src/project-graph/utils/project-configuration-utils.js +94 -30
- package/src/utils/assert-workspace-validity.js +2 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.0.0-canary.
|
3
|
+
"version": "19.0.0-canary.20240504-fd5ea92",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"yargs-parser": "21.1.1",
|
67
67
|
"node-machine-id": "1.1.12",
|
68
68
|
"ora": "5.3.0",
|
69
|
-
"@nrwl/tao": "19.0.0-canary.
|
69
|
+
"@nrwl/tao": "19.0.0-canary.20240504-fd5ea92"
|
70
70
|
},
|
71
71
|
"peerDependencies": {
|
72
72
|
"@swc-node/register": "^1.8.0",
|
@@ -81,16 +81,16 @@
|
|
81
81
|
}
|
82
82
|
},
|
83
83
|
"optionalDependencies": {
|
84
|
-
"@nx/nx-darwin-x64": "19.0.0-canary.
|
85
|
-
"@nx/nx-darwin-arm64": "19.0.0-canary.
|
86
|
-
"@nx/nx-linux-x64-gnu": "19.0.0-canary.
|
87
|
-
"@nx/nx-linux-x64-musl": "19.0.0-canary.
|
88
|
-
"@nx/nx-win32-x64-msvc": "19.0.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "19.0.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "19.0.0-canary.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "19.0.0-canary.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "19.0.0-canary.
|
93
|
-
"@nx/nx-freebsd-x64": "19.0.0-canary.
|
84
|
+
"@nx/nx-darwin-x64": "19.0.0-canary.20240504-fd5ea92",
|
85
|
+
"@nx/nx-darwin-arm64": "19.0.0-canary.20240504-fd5ea92",
|
86
|
+
"@nx/nx-linux-x64-gnu": "19.0.0-canary.20240504-fd5ea92",
|
87
|
+
"@nx/nx-linux-x64-musl": "19.0.0-canary.20240504-fd5ea92",
|
88
|
+
"@nx/nx-win32-x64-msvc": "19.0.0-canary.20240504-fd5ea92",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "19.0.0-canary.20240504-fd5ea92",
|
90
|
+
"@nx/nx-linux-arm64-musl": "19.0.0-canary.20240504-fd5ea92",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "19.0.0-canary.20240504-fd5ea92",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "19.0.0-canary.20240504-fd5ea92",
|
93
|
+
"@nx/nx-freebsd-x64": "19.0.0-canary.20240504-fd5ea92"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.addHandler = void 0;
|
3
|
+
exports.coreNxPluginVersions = exports.addHandler = void 0;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
const fs_1 = require("fs");
|
6
6
|
const ora = require("ora");
|
@@ -15,6 +15,7 @@ const params_1 = require("../../utils/params");
|
|
15
15
|
const plugins_1 = require("../../utils/plugins");
|
16
16
|
const versions_1 = require("../../utils/versions");
|
17
17
|
const workspace_root_1 = require("../../utils/workspace-root");
|
18
|
+
const add_nx_scripts_1 = require("../init/implementation/dot-nx/add-nx-scripts");
|
18
19
|
function addHandler(options) {
|
19
20
|
if (options.verbose) {
|
20
21
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
@@ -52,7 +53,7 @@ async function installPackage(pkgName, version, nxJson) {
|
|
52
53
|
}
|
53
54
|
else {
|
54
55
|
nxJson.installation.plugins ??= {};
|
55
|
-
nxJson.installation.plugins[pkgName] = version;
|
56
|
+
nxJson.installation.plugins[pkgName] = (0, add_nx_scripts_1.normalizeVersionForNxJson)(pkgName, version);
|
56
57
|
(0, fileutils_1.writeJsonFile)('nx.json', nxJson);
|
57
58
|
try {
|
58
59
|
await (0, child_process_2.runNxAsync)('--help', { silent: true });
|
@@ -92,7 +93,7 @@ async function initializePlugin(pkgName, options, nxJson) {
|
|
92
93
|
spinner.start();
|
93
94
|
try {
|
94
95
|
const args = [];
|
95
|
-
if (
|
96
|
+
if (exports.coreNxPluginVersions.has(pkgName)) {
|
96
97
|
args.push(`--keepExistingVersions`);
|
97
98
|
if (options.updatePackageScripts ||
|
98
99
|
(options.updatePackageScripts === undefined &&
|
@@ -133,8 +134,8 @@ function findInitGenerator(generators) {
|
|
133
134
|
function parsePackageSpecifier(packageSpecifier) {
|
134
135
|
const i = packageSpecifier.lastIndexOf('@');
|
135
136
|
if (i <= 0) {
|
136
|
-
if (
|
137
|
-
return [packageSpecifier,
|
137
|
+
if (exports.coreNxPluginVersions.has(packageSpecifier)) {
|
138
|
+
return [packageSpecifier, exports.coreNxPluginVersions.get(packageSpecifier)];
|
138
139
|
}
|
139
140
|
return [packageSpecifier, 'latest'];
|
140
141
|
}
|
@@ -142,31 +143,10 @@ function parsePackageSpecifier(packageSpecifier) {
|
|
142
143
|
const version = packageSpecifier.substring(i + 1);
|
143
144
|
return [pkgName, version];
|
144
145
|
}
|
145
|
-
|
146
|
-
'
|
147
|
-
'
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
'@nx/eslint-plugin',
|
153
|
-
'@nx/expo',
|
154
|
-
'@nx/express',
|
155
|
-
'@nx/jest',
|
156
|
-
'@nx/nest',
|
157
|
-
'@nx/next',
|
158
|
-
'@nx/node',
|
159
|
-
'@nx/nuxt',
|
160
|
-
'@nx/playwright',
|
161
|
-
'@nx/plugin',
|
162
|
-
'@nx/react',
|
163
|
-
'@nx/react-native',
|
164
|
-
'@nx/remix',
|
165
|
-
'@nx/rollup',
|
166
|
-
'@nx/storybook',
|
167
|
-
'@nx/vite',
|
168
|
-
'@nx/vue',
|
169
|
-
'@nx/web',
|
170
|
-
'@nx/webpack',
|
171
|
-
'@nx/workspace',
|
172
|
-
];
|
146
|
+
exports.coreNxPluginVersions = require('../../../package.json')['nx-migrations'].packageGroup.reduce((map, entry) => {
|
147
|
+
const packageName = typeof entry === 'string' ? entry : entry.package;
|
148
|
+
const version = typeof entry === 'string' ? versions_1.nxVersion : entry.version;
|
149
|
+
return map.set(packageName, version);
|
150
|
+
},
|
151
|
+
// Package Name -> Desired Version
|
152
|
+
new Map());
|
@@ -169,9 +169,6 @@ async function generateGraph(args, affectedProjects) {
|
|
169
169
|
}
|
170
170
|
catch (e) {
|
171
171
|
if (e instanceof error_types_1.ProjectGraphError) {
|
172
|
-
output_1.output.warn({
|
173
|
-
title: 'Failed to process project graph. Showing partial graph.',
|
174
|
-
});
|
175
172
|
rawGraph = e.getPartialProjectGraph();
|
176
173
|
sourceMaps = e.getPartialSourcemaps();
|
177
174
|
isPartial = true;
|
@@ -179,6 +176,20 @@ async function generateGraph(args, affectedProjects) {
|
|
179
176
|
if (!rawGraph) {
|
180
177
|
(0, project_graph_1.handleProjectGraphError)({ exitOnError: true }, e);
|
181
178
|
}
|
179
|
+
else {
|
180
|
+
const errors = e.getErrors();
|
181
|
+
if (errors?.length > 0) {
|
182
|
+
errors.forEach((e) => {
|
183
|
+
output_1.output.error({
|
184
|
+
title: e.message,
|
185
|
+
bodyLines: [e.stack],
|
186
|
+
});
|
187
|
+
});
|
188
|
+
}
|
189
|
+
output_1.output.warn({
|
190
|
+
title: `${errors?.length > 1 ? `${errors.length} errors` : `An error`} occured while processing the project graph. Showing partial graph.`,
|
191
|
+
});
|
192
|
+
}
|
182
193
|
}
|
183
194
|
let prunedGraph = (0, operators_1.pruneExternalNodes)(rawGraph);
|
184
195
|
const projects = Object.values(prunedGraph.nodes);
|
@@ -448,6 +459,19 @@ function createFileWatcher() {
|
|
448
459
|
if (projectGraphClientResponse.hash !==
|
449
460
|
currentProjectGraphClientResponse.hash &&
|
450
461
|
sourceMapResponse) {
|
462
|
+
if (projectGraphClientResponse.errors?.length > 0) {
|
463
|
+
projectGraphClientResponse.errors.forEach((e) => {
|
464
|
+
output_1.output.error({
|
465
|
+
title: e.message,
|
466
|
+
bodyLines: [e.stack],
|
467
|
+
});
|
468
|
+
});
|
469
|
+
output_1.output.warn({
|
470
|
+
title: `${projectGraphClientResponse.errors.length > 1
|
471
|
+
? `${projectGraphClientResponse.errors.length} errors`
|
472
|
+
: `An error`} occured while processing the project graph. Showing partial graph.`,
|
473
|
+
});
|
474
|
+
}
|
451
475
|
output_1.output.note({ title: 'Graph changes updated.' });
|
452
476
|
currentProjectGraphClientResponse = projectGraphClientResponse;
|
453
477
|
currentSourceMapsClientResponse = sourceMapResponse;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Tree } from '../../../../generators/tree';
|
2
2
|
export declare const nxWrapperPath: (p?: typeof import('path')) => string;
|
3
3
|
export declare function generateDotNxSetup(version?: string): void;
|
4
|
+
export declare function normalizeVersionForNxJson(pkg: string, version: string): string;
|
4
5
|
export declare function writeMinimalNxJson(host: Tree, version: string): void;
|
5
6
|
export declare function updateGitIgnore(host: Tree): void;
|
6
7
|
export declare function getNxWrapperContents(): string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sanitizeWrapperScript = exports.getNxWrapperContents = exports.updateGitIgnore = exports.writeMinimalNxJson = exports.generateDotNxSetup = exports.nxWrapperPath = void 0;
|
3
|
+
exports.sanitizeWrapperScript = exports.getNxWrapperContents = exports.updateGitIgnore = exports.writeMinimalNxJson = exports.normalizeVersionForNxJson = exports.generateDotNxSetup = exports.nxWrapperPath = void 0;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
const fs_1 = require("fs");
|
6
6
|
const path = require("path");
|
@@ -36,29 +36,18 @@ function generateDotNxSetup(version) {
|
|
36
36
|
(0, tree_1.flushChanges)(host.root, changes);
|
37
37
|
}
|
38
38
|
exports.generateDotNxSetup = generateDotNxSetup;
|
39
|
+
function normalizeVersionForNxJson(pkg, version) {
|
40
|
+
if (!(0, semver_1.valid)(version)) {
|
41
|
+
version = (0, child_process_1.execSync)(`npm view ${pkg}@${version} version`).toString();
|
42
|
+
}
|
43
|
+
return version.trimEnd();
|
44
|
+
}
|
45
|
+
exports.normalizeVersionForNxJson = normalizeVersionForNxJson;
|
39
46
|
function writeMinimalNxJson(host, version) {
|
40
47
|
if (!host.exists('nx.json')) {
|
41
|
-
if (!(0, semver_1.valid)(version)) {
|
42
|
-
version = (0, child_process_1.execSync)(`npm view nx@${version} version`).toString();
|
43
|
-
}
|
44
48
|
(0, json_1.writeJson)(host, 'nx.json', {
|
45
|
-
targetDefaults: {
|
46
|
-
build: {
|
47
|
-
cache: true,
|
48
|
-
dependsOn: ['^build'],
|
49
|
-
},
|
50
|
-
lint: {
|
51
|
-
cache: true,
|
52
|
-
},
|
53
|
-
test: {
|
54
|
-
cache: true,
|
55
|
-
},
|
56
|
-
e2e: {
|
57
|
-
cache: true,
|
58
|
-
},
|
59
|
-
},
|
60
49
|
installation: {
|
61
|
-
version: version
|
50
|
+
version: normalizeVersionForNxJson('nx', version),
|
62
51
|
},
|
63
52
|
});
|
64
53
|
}
|