nx 20.0.3 → 20.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +11 -11
- package/src/command-line/add/add.js +9 -2
- package/src/command-line/nx-commands.js +1 -1
- package/src/native/index.d.ts +4 -4
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/cache.d.ts +1 -0
- package/src/tasks-runner/cache.js +1 -0
- package/src/tasks-runner/run-command.js +1 -1
- package/src/utils/db-connection.d.ts +1 -1
- package/src/migrations/update-15-0-0/migrate-to-inputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +0 -102
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.d.ts +0 -2
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +0 -21
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.0.
|
3
|
+
"version": "20.0.5",
|
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": {
|
@@ -80,16 +80,16 @@
|
|
80
80
|
}
|
81
81
|
},
|
82
82
|
"optionalDependencies": {
|
83
|
-
"@nx/nx-darwin-x64": "20.0.
|
84
|
-
"@nx/nx-darwin-arm64": "20.0.
|
85
|
-
"@nx/nx-linux-x64-gnu": "20.0.
|
86
|
-
"@nx/nx-linux-x64-musl": "20.0.
|
87
|
-
"@nx/nx-win32-x64-msvc": "20.0.
|
88
|
-
"@nx/nx-linux-arm64-gnu": "20.0.
|
89
|
-
"@nx/nx-linux-arm64-musl": "20.0.
|
90
|
-
"@nx/nx-linux-arm-gnueabihf": "20.0.
|
91
|
-
"@nx/nx-win32-arm64-msvc": "20.0.
|
92
|
-
"@nx/nx-freebsd-x64": "20.0.
|
83
|
+
"@nx/nx-darwin-x64": "20.0.5",
|
84
|
+
"@nx/nx-darwin-arm64": "20.0.5",
|
85
|
+
"@nx/nx-linux-x64-gnu": "20.0.5",
|
86
|
+
"@nx/nx-linux-x64-musl": "20.0.5",
|
87
|
+
"@nx/nx-win32-x64-msvc": "20.0.5",
|
88
|
+
"@nx/nx-linux-arm64-gnu": "20.0.5",
|
89
|
+
"@nx/nx-linux-arm64-musl": "20.0.5",
|
90
|
+
"@nx/nx-linux-arm-gnueabihf": "20.0.5",
|
91
|
+
"@nx/nx-win32-arm64-msvc": "20.0.5",
|
92
|
+
"@nx/nx-freebsd-x64": "20.0.5"
|
93
93
|
},
|
94
94
|
"nx-migrations": {
|
95
95
|
"migrations": "./migrations.json",
|
@@ -17,6 +17,7 @@ const plugins_1 = require("../../utils/plugins");
|
|
17
17
|
const versions_1 = require("../../utils/versions");
|
18
18
|
const workspace_root_1 = require("../../utils/workspace-root");
|
19
19
|
const add_nx_scripts_1 = require("../init/implementation/dot-nx/add-nx-scripts");
|
20
|
+
const semver_1 = require("semver");
|
20
21
|
function addHandler(options) {
|
21
22
|
return (0, handle_errors_1.handleErrors)(options.verbose, async () => {
|
22
23
|
output_1.output.addNewline();
|
@@ -33,8 +34,14 @@ async function installPackage(pkgName, version, nxJson) {
|
|
33
34
|
const spinner = ora(`Installing ${pkgName}@${version}...`);
|
34
35
|
spinner.start();
|
35
36
|
if ((0, fs_1.existsSync)('package.json')) {
|
36
|
-
const
|
37
|
-
|
37
|
+
const pm = (0, package_manager_1.detectPackageManager)();
|
38
|
+
const pmv = (0, package_manager_1.getPackageManagerVersion)(pm);
|
39
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)(pm);
|
40
|
+
// if we explicitly specify latest in yarn berry, it won't resolve the version
|
41
|
+
const command = pm === 'yarn' && (0, semver_1.gte)(pmv, '2.0.0') && version === 'latest'
|
42
|
+
? `${pmc.addDev} ${pkgName}`
|
43
|
+
: `${pmc.addDev} ${pkgName}@${version}`;
|
44
|
+
await new Promise((resolve) => (0, child_process_1.exec)(command, {
|
38
45
|
windowsHide: false,
|
39
46
|
}, (error, stdout) => {
|
40
47
|
if (error) {
|
@@ -101,7 +101,7 @@ function createMissingConformanceCommand(command) {
|
|
101
101
|
bodyLines: [
|
102
102
|
`In order to use the \`nx ${command}\` command you must have an active Powerpack license and the \`@nx/powerpack-conformance\` plugin installed.`,
|
103
103
|
'',
|
104
|
-
'To learn more, visit https://nx.dev/
|
104
|
+
'To learn more, visit https://nx.dev/nx-enterprise/powerpack/conformance',
|
105
105
|
],
|
106
106
|
});
|
107
107
|
process.exit(1);
|
package/src/native/index.d.ts
CHANGED
@@ -28,7 +28,7 @@ export declare class ImportResult {
|
|
28
28
|
|
29
29
|
export declare class NxCache {
|
30
30
|
cacheDirectory: string
|
31
|
-
constructor(workspaceRoot: string, cachePath: string, dbConnection: ExternalObject<
|
31
|
+
constructor(workspaceRoot: string, cachePath: string, dbConnection: ExternalObject<NxDbConnection>, linkTaskDetails?: boolean | undefined | null)
|
32
32
|
get(hash: string): CachedResult | null
|
33
33
|
put(hash: string, terminalOutput: string, outputs: Array<string>, code: number): void
|
34
34
|
applyRemoteCacheResults(hash: string, result: CachedResult): void
|
@@ -39,7 +39,7 @@ export declare class NxCache {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
export declare class NxTaskHistory {
|
42
|
-
constructor(db: ExternalObject<
|
42
|
+
constructor(db: ExternalObject<NxDbConnection>)
|
43
43
|
recordTaskRuns(taskRuns: Array<TaskRun>): void
|
44
44
|
getFlakyTasks(hashes: Array<string>): Array<string>
|
45
45
|
getEstimatedTaskTimings(targets: Array<TaskTarget>): Record<string, number>
|
@@ -56,7 +56,7 @@ export declare class RustPseudoTerminal {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
export declare class TaskDetails {
|
59
|
-
constructor(db: ExternalObject<
|
59
|
+
constructor(db: ExternalObject<NxDbConnection>)
|
60
60
|
recordTaskDetails(tasks: Array<HashedTask>): void
|
61
61
|
}
|
62
62
|
|
@@ -97,7 +97,7 @@ export interface CachedResult {
|
|
97
97
|
outputsPath: string
|
98
98
|
}
|
99
99
|
|
100
|
-
export declare export function connectToNxDb(cacheDir: string, nxVersion: string, dbName?: string | undefined | null): ExternalObject<
|
100
|
+
export declare export function connectToNxDb(cacheDir: string, nxVersion: string, dbName?: string | undefined | null): ExternalObject<NxDbConnection>
|
101
101
|
|
102
102
|
export declare export function copy(src: string, dest: string): void
|
103
103
|
|
Binary file
|
@@ -39,6 +39,7 @@ class DbCache {
|
|
39
39
|
constructor(options) {
|
40
40
|
this.options = options;
|
41
41
|
this.cache = new native_1.NxCache(workspace_root_1.workspaceRoot, cache_directory_1.cacheDir, (0, db_connection_1.getDbConnection)());
|
42
|
+
this.isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
42
43
|
}
|
43
44
|
async init() {
|
44
45
|
// This should be cheap because we've already loaded
|
@@ -522,7 +522,7 @@ function getRunner(nxArgs, nxJson) {
|
|
522
522
|
title: `Custom task runners will no longer be supported in Nx 21.`,
|
523
523
|
bodyLines: [
|
524
524
|
`Use Nx Cloud or the Nx Powerpack caches instead.`,
|
525
|
-
`For more information, see https://nx.dev/
|
525
|
+
`For more information, see https://nx.dev/nx-enterprise/powerpack/custom-caching`,
|
526
526
|
],
|
527
527
|
});
|
528
528
|
}
|
@@ -1,102 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
5
|
-
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
6
|
-
const nx_json_1 = require("../../generators/utils/nx-json");
|
7
|
-
const path_1 = require("../../utils/path");
|
8
|
-
const path_2 = require("path");
|
9
|
-
const json_1 = require("../../generators/utils/json");
|
10
|
-
const skippedFiles = [
|
11
|
-
'package.json', // Not to be added to filesets
|
12
|
-
'babel.config.json', // Will be handled by various plugins
|
13
|
-
'karma.conf.js', // Will be handled by @nx/angular
|
14
|
-
'jest.preset.js', // Will be handled by @nx/jest
|
15
|
-
'.storybook', // Will be handled by @nx/storybook
|
16
|
-
// Will be handled by @nx/eslint
|
17
|
-
'.eslintrc.json',
|
18
|
-
'.eslintrc.js',
|
19
|
-
];
|
20
|
-
async function default_1(tree) {
|
21
|
-
// If the workspace doesn't have a nx.json, don't make any changes
|
22
|
-
if (!tree.exists('nx.json')) {
|
23
|
-
return;
|
24
|
-
}
|
25
|
-
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
26
|
-
// If this is a npm workspace, don't make any changes
|
27
|
-
if (nxJson.extends === 'nx/presets/npm.json') {
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
nxJson.namedInputs ??= {
|
31
|
-
default: ['{projectRoot}/**/*', 'sharedGlobals'],
|
32
|
-
sharedGlobals: [],
|
33
|
-
production: ['default'],
|
34
|
-
};
|
35
|
-
if (nxJson.namedInputs.default) {
|
36
|
-
if (!nxJson.namedInputs.production) {
|
37
|
-
nxJson.namedInputs.production = ['default'];
|
38
|
-
}
|
39
|
-
else if (!nxJson.namedInputs.production.includes('default')) {
|
40
|
-
nxJson.namedInputs.production = [
|
41
|
-
'default',
|
42
|
-
...nxJson.namedInputs.production,
|
43
|
-
];
|
44
|
-
}
|
45
|
-
}
|
46
|
-
if (isBuildATarget(tree)) {
|
47
|
-
nxJson.targetDefaults ??= {};
|
48
|
-
nxJson.targetDefaults.build ??= {};
|
49
|
-
nxJson.targetDefaults.build.inputs ??= ['production', '^production'];
|
50
|
-
}
|
51
|
-
if (nxJson.implicitDependencies) {
|
52
|
-
const projects = (0, project_configuration_1.getProjects)(tree);
|
53
|
-
for (const [files, dependents] of Object.entries(nxJson.implicitDependencies)) {
|
54
|
-
// Skip these because other plugins take care of them
|
55
|
-
if (skippedFiles.includes(files)) {
|
56
|
-
continue;
|
57
|
-
}
|
58
|
-
else if (Array.isArray(dependents)) {
|
59
|
-
nxJson.namedInputs.projectSpecificFiles = [];
|
60
|
-
const defaultFileset = new Set(nxJson.namedInputs.default ?? ['{projectRoot}/**/*', 'sharedGlobals']);
|
61
|
-
defaultFileset.add('projectSpecificFiles');
|
62
|
-
nxJson.namedInputs.default = Array.from(defaultFileset);
|
63
|
-
for (const dependent of dependents) {
|
64
|
-
const project = projects.get(dependent);
|
65
|
-
project.namedInputs ??= {};
|
66
|
-
const projectSpecificFileset = new Set(project.namedInputs.projectSpecificFiles ?? []);
|
67
|
-
projectSpecificFileset.add((0, path_1.joinPathFragments)('{workspaceRoot}', files));
|
68
|
-
project.namedInputs.projectSpecificFiles = Array.from(projectSpecificFileset);
|
69
|
-
try {
|
70
|
-
(0, project_configuration_1.updateProjectConfiguration)(tree, dependent, project);
|
71
|
-
}
|
72
|
-
catch {
|
73
|
-
if (tree.exists((0, path_2.join)(project.root, 'package.json'))) {
|
74
|
-
(0, json_1.updateJson)(tree, (0, path_2.join)(project.root, 'package.json'), (json) => {
|
75
|
-
json.nx ??= {};
|
76
|
-
json.nx.namedInputs ??= {};
|
77
|
-
json.nx.namedInputs.projectSpecificFiles ??=
|
78
|
-
project.namedInputs.projectSpecificFiles;
|
79
|
-
return json;
|
80
|
-
});
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
nxJson.namedInputs.sharedGlobals.push((0, path_1.joinPathFragments)('{workspaceRoot}', files));
|
87
|
-
}
|
88
|
-
}
|
89
|
-
delete nxJson.implicitDependencies;
|
90
|
-
}
|
91
|
-
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
92
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
93
|
-
}
|
94
|
-
function isBuildATarget(tree) {
|
95
|
-
const projects = (0, project_configuration_1.getProjects)(tree);
|
96
|
-
for (const [_, project] of projects) {
|
97
|
-
if (project.targets?.build) {
|
98
|
-
return true;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
return false;
|
102
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = removeProjectNameAndRootFormat;
|
4
|
-
const json_1 = require("../../generators/utils/json");
|
5
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
|
-
async function removeProjectNameAndRootFormat(tree) {
|
7
|
-
if (!tree.exists('nx.json')) {
|
8
|
-
return;
|
9
|
-
}
|
10
|
-
(0, json_1.updateJson)(tree, 'nx.json', (nxJson) => {
|
11
|
-
if (!nxJson.workspaceLayout) {
|
12
|
-
return nxJson;
|
13
|
-
}
|
14
|
-
delete nxJson.workspaceLayout.projectNameAndRootFormat;
|
15
|
-
if (Object.keys(nxJson.workspaceLayout).length === 0) {
|
16
|
-
delete nxJson.workspaceLayout;
|
17
|
-
}
|
18
|
-
return nxJson;
|
19
|
-
});
|
20
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
21
|
-
}
|