nx 19.8.2 → 19.8.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.json +12 -2
- package/package.json +12 -12
- package/src/command-line/add/add.js +2 -2
- package/src/command-line/import/utils/prepare-source-repo.js +8 -3
- package/src/command-line/nx-commands.js +31 -10
- package/src/command-line/release/utils/print-changes.js +6 -4
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
- package/src/command-line/reset/reset.js +16 -9
- package/src/command-line/yargs-utils/shared-options.js +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/executors/run-commands/run-commands.impl.js +15 -22
- package/src/hasher/hash-task.d.ts +4 -2
- package/src/hasher/hash-task.js +6 -9
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +54 -6
- package/src/nx-cloud/utilities/axios.js +1 -2
- package/src/nx-cloud/utilities/onboarding.js +2 -2
- package/src/nx-cloud/utilities/url-shorten.js +5 -5
- package/src/project-graph/utils/project-configuration-utils.js +1 -1
- package/src/tasks-runner/cache.d.ts +2 -1
- package/src/tasks-runner/cache.js +10 -6
- package/src/tasks-runner/create-task-graph.d.ts +2 -0
- package/src/tasks-runner/create-task-graph.js +39 -5
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +7 -0
- package/src/tasks-runner/run-command.js +3 -1
- package/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/src/tasks-runner/task-orchestrator.js +7 -3
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +6 -2
- package/src/utils/git-utils.js +2 -2
- package/src/utils/plugins/output.js +1 -1
package/.eslintrc.json
CHANGED
@@ -9,8 +9,18 @@
|
|
9
9
|
"no-restricted-imports": [
|
10
10
|
"error",
|
11
11
|
{
|
12
|
-
"
|
13
|
-
|
12
|
+
"paths": [
|
13
|
+
{
|
14
|
+
"name": "fs-extra",
|
15
|
+
"message": "Please use equivalent utilities from `node:fs` instead."
|
16
|
+
}
|
17
|
+
],
|
18
|
+
"patterns": [
|
19
|
+
{
|
20
|
+
"group": ["**/devkit-exports"],
|
21
|
+
"message": "Do not import from devkit-exports from the nx package"
|
22
|
+
}
|
23
|
+
]
|
14
24
|
}
|
15
25
|
]
|
16
26
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.8.
|
3
|
+
"version": "19.8.4",
|
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": {
|
@@ -67,7 +67,7 @@
|
|
67
67
|
"yargs-parser": "21.1.1",
|
68
68
|
"node-machine-id": "1.1.12",
|
69
69
|
"ora": "5.3.0",
|
70
|
-
"@nrwl/tao": "19.8.
|
70
|
+
"@nrwl/tao": "19.8.4"
|
71
71
|
},
|
72
72
|
"peerDependencies": {
|
73
73
|
"@swc-node/register": "^1.8.0",
|
@@ -82,16 +82,16 @@
|
|
82
82
|
}
|
83
83
|
},
|
84
84
|
"optionalDependencies": {
|
85
|
-
"@nx/nx-darwin-x64": "19.8.
|
86
|
-
"@nx/nx-darwin-arm64": "19.8.
|
87
|
-
"@nx/nx-linux-x64-gnu": "19.8.
|
88
|
-
"@nx/nx-linux-x64-musl": "19.8.
|
89
|
-
"@nx/nx-win32-x64-msvc": "19.8.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "19.8.
|
91
|
-
"@nx/nx-linux-arm64-musl": "19.8.
|
92
|
-
"@nx/nx-linux-arm-gnueabihf": "19.8.
|
93
|
-
"@nx/nx-win32-arm64-msvc": "19.8.
|
94
|
-
"@nx/nx-freebsd-x64": "19.8.
|
85
|
+
"@nx/nx-darwin-x64": "19.8.4",
|
86
|
+
"@nx/nx-darwin-arm64": "19.8.4",
|
87
|
+
"@nx/nx-linux-x64-gnu": "19.8.4",
|
88
|
+
"@nx/nx-linux-x64-musl": "19.8.4",
|
89
|
+
"@nx/nx-win32-x64-msvc": "19.8.4",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "19.8.4",
|
91
|
+
"@nx/nx-linux-arm64-musl": "19.8.4",
|
92
|
+
"@nx/nx-linux-arm-gnueabihf": "19.8.4",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "19.8.4",
|
94
|
+
"@nx/nx-freebsd-x64": "19.8.4"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
@@ -103,8 +103,8 @@ async function initializePlugin(pkgName, options, nxJson) {
|
|
103
103
|
if (options.__overrides_unparsed__.length) {
|
104
104
|
args.push(...options.__overrides_unparsed__);
|
105
105
|
}
|
106
|
-
|
107
|
-
|
106
|
+
(0, child_process_2.runNxSync)(`g ${pkgName}:${initGenerator} ${args.join(' ')}`, {
|
107
|
+
stdio: [0, 1, 2],
|
108
108
|
});
|
109
109
|
}
|
110
110
|
catch (e) {
|
@@ -6,15 +6,20 @@ const path_1 = require("path");
|
|
6
6
|
async function prepareSourceRepo(gitClient, ref, source, relativeDestination, tempImportBranch, sourceRemoteUrl) {
|
7
7
|
const spinner = createSpinner().start(`Fetching ${ref} from ${sourceRemoteUrl}`);
|
8
8
|
const relativeSourceDir = (0, path_1.relative)(gitClient.root, (0, path_1.join)(gitClient.root, source));
|
9
|
+
const message = relativeSourceDir.trim()
|
10
|
+
? `Filtering git history to only include files in ${relativeSourceDir}`
|
11
|
+
: `Filtering git history`;
|
9
12
|
if (await gitClient.hasFilterRepoInstalled()) {
|
10
|
-
spinner.start(
|
13
|
+
spinner.start(message);
|
11
14
|
await gitClient.filterRepo(relativeSourceDir, relativeDestination);
|
12
15
|
}
|
13
16
|
else {
|
14
|
-
spinner.start(
|
17
|
+
spinner.start(`${message} (this might take a few minutes -- install git-filter-repo for faster performance)`);
|
15
18
|
await gitClient.filterBranch(relativeSourceDir, relativeDestination, tempImportBranch);
|
16
19
|
}
|
17
|
-
spinner.succeed(
|
20
|
+
spinner.succeed(relativeSourceDir.trim()
|
21
|
+
? `Filtered git history to only include files in ${relativeSourceDir}`
|
22
|
+
: `Filtered git history`);
|
18
23
|
spinner.succeed(`${sourceRemoteUrl} has been prepared to be imported into this workspace on a temporary branch: ${tempImportBranch} in ${gitClient.root}`);
|
19
24
|
}
|
20
25
|
function wait(ms) {
|
@@ -29,6 +29,7 @@ const command_object_23 = require("./login/command-object");
|
|
29
29
|
const command_object_24 = require("./logout/command-object");
|
30
30
|
const command_objects_1 = require("./deprecated/command-objects");
|
31
31
|
const command_object_25 = require("./sync/command-object");
|
32
|
+
const output_1 = require("../utils/output");
|
32
33
|
// Ensure that the output takes up the available width of the terminal.
|
33
34
|
yargs.wrap(yargs.terminalWidth());
|
34
35
|
exports.parserConfiguration = {
|
@@ -82,26 +83,46 @@ exports.commandsObject = yargs
|
|
82
83
|
.command(command_object_23.yargsLoginCommand)
|
83
84
|
.command(command_object_24.yargsLogoutCommand)
|
84
85
|
.command(resolveConformanceCommandObject())
|
86
|
+
.command(resolveConformanceCheckCommandObject())
|
85
87
|
.scriptName('nx')
|
86
88
|
.help()
|
87
89
|
// NOTE: we handle --version in nx.ts, this just tells yargs that the option exists
|
88
90
|
// so that it shows up in help. The default yargs implementation of --version is not
|
89
91
|
// hit, as the implementation in nx.ts is hit first and calls process.exit(0).
|
90
92
|
.version();
|
93
|
+
function createMissingConformanceCommand(command) {
|
94
|
+
return {
|
95
|
+
command,
|
96
|
+
// Hide from --help output in the common case of not having the plugin installed
|
97
|
+
describe: false,
|
98
|
+
handler: () => {
|
99
|
+
output_1.output.error({
|
100
|
+
title: `${command} is not available`,
|
101
|
+
bodyLines: [
|
102
|
+
`In order to use the \`nx ${command}\` command you must have an active Powerpack license and the \`@nx/powerpack-conformance\` plugin installed.`,
|
103
|
+
'',
|
104
|
+
'To learn more, visit https://nx.dev/features/powerpack/conformance',
|
105
|
+
],
|
106
|
+
});
|
107
|
+
process.exit(1);
|
108
|
+
},
|
109
|
+
};
|
110
|
+
}
|
91
111
|
function resolveConformanceCommandObject() {
|
92
112
|
try {
|
93
113
|
const { yargsConformanceCommand } = require('@nx/powerpack-conformance');
|
94
114
|
return yargsConformanceCommand;
|
95
115
|
}
|
96
|
-
catch
|
97
|
-
return
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
116
|
+
catch {
|
117
|
+
return createMissingConformanceCommand('conformance');
|
118
|
+
}
|
119
|
+
}
|
120
|
+
function resolveConformanceCheckCommandObject() {
|
121
|
+
try {
|
122
|
+
const { yargsConformanceCheckCommand, } = require('@nx/powerpack-conformance');
|
123
|
+
return yargsConformanceCheckCommand;
|
124
|
+
}
|
125
|
+
catch {
|
126
|
+
return createMissingConformanceCommand('conformance:check');
|
106
127
|
}
|
107
128
|
}
|
@@ -5,8 +5,10 @@ exports.printAndFlushChanges = printAndFlushChanges;
|
|
5
5
|
const chalk = require("chalk");
|
6
6
|
const jest_diff_1 = require("jest-diff");
|
7
7
|
const node_fs_1 = require("node:fs");
|
8
|
-
const devkit_exports_1 = require("../../../devkit-exports");
|
9
8
|
const tree_1 = require("../../../generators/tree");
|
9
|
+
const workspace_root_1 = require("../../../utils/workspace-root");
|
10
|
+
const path_1 = require("../../../utils/path");
|
11
|
+
const logger_1 = require("../../../utils/logger");
|
10
12
|
// jest-diff does not export this constant
|
11
13
|
const NO_DIFF_MESSAGE = 'Compared values have no visual difference.';
|
12
14
|
function printDiff(before, after, contextLines = 1, noDiffMessage = NO_DIFF_MESSAGE) {
|
@@ -43,7 +45,7 @@ function printAndFlushChanges(tree, isDryRun, diffContextLines = 1, shouldPrintD
|
|
43
45
|
}
|
44
46
|
else if (f.type === 'UPDATE') {
|
45
47
|
console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
|
46
|
-
const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0,
|
48
|
+
const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
|
47
49
|
printDiff(currentContentsOnDisk, f.content?.toString() || '', diffContextLines, noDiffMessage);
|
48
50
|
}
|
49
51
|
else if (f.type === 'DELETE') {
|
@@ -51,9 +53,9 @@ function printAndFlushChanges(tree, isDryRun, diffContextLines = 1, shouldPrintD
|
|
51
53
|
}
|
52
54
|
});
|
53
55
|
if (!isDryRun) {
|
54
|
-
(0, tree_1.flushChanges)(
|
56
|
+
(0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
|
55
57
|
}
|
56
58
|
if (isDryRun && shouldPrintDryRunMessage) {
|
57
|
-
|
59
|
+
logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
|
58
60
|
}
|
59
61
|
}
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveNxJsonConfigErrorMessage = resolveNxJsonConfigErrorMessage;
|
4
4
|
const node_fs_1 = require("node:fs");
|
5
5
|
const node_path_1 = require("node:path");
|
6
|
-
const
|
6
|
+
const path_1 = require("../../../utils/path");
|
7
|
+
const workspace_root_1 = require("../../../utils/workspace-root");
|
7
8
|
async function resolveNxJsonConfigErrorMessage(propPath) {
|
8
|
-
const errorLines = await getJsonConfigLinesForErrorMessage((0, node_fs_1.readFileSync)((0,
|
9
|
-
let nxJsonMessage = `The relevant config is defined here: ${(0, node_path_1.relative)(process.cwd(), (0,
|
9
|
+
const errorLines = await getJsonConfigLinesForErrorMessage((0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(workspace_root_1.workspaceRoot, 'nx.json'), 'utf-8'), propPath);
|
10
|
+
let nxJsonMessage = `The relevant config is defined here: ${(0, node_path_1.relative)(process.cwd(), (0, path_1.joinPathFragments)(workspace_root_1.workspaceRoot, 'nx.json'))}`;
|
10
11
|
if (errorLines) {
|
11
12
|
nxJsonMessage +=
|
12
13
|
errorLines.startLine === errorLines.endLine
|
@@ -37,16 +37,16 @@ async function resetHandler(args) {
|
|
37
37
|
try {
|
38
38
|
await killDaemon();
|
39
39
|
}
|
40
|
-
catch {
|
41
|
-
errors.push('Failed to stop the Nx Daemon.');
|
40
|
+
catch (e) {
|
41
|
+
errors.push('Failed to stop the Nx Daemon.', e.toString());
|
42
42
|
}
|
43
43
|
}
|
44
44
|
if (all || args.onlyCache) {
|
45
45
|
try {
|
46
46
|
await cleanupCacheEntries();
|
47
47
|
}
|
48
|
-
catch {
|
49
|
-
errors.push('Failed to clean up the cache directory.');
|
48
|
+
catch (e) {
|
49
|
+
errors.push('Failed to clean up the cache directory.', e.toString());
|
50
50
|
}
|
51
51
|
}
|
52
52
|
if (all || args.onlyWorkspaceData) {
|
@@ -59,12 +59,17 @@ async function resetHandler(args) {
|
|
59
59
|
try {
|
60
60
|
await cleanupWorkspaceData();
|
61
61
|
}
|
62
|
-
catch {
|
63
|
-
errors.push('Failed to clean up the workspace data directory.');
|
62
|
+
catch (e) {
|
63
|
+
errors.push('Failed to clean up the workspace data directory.', e.toString());
|
64
64
|
}
|
65
65
|
}
|
66
66
|
if (all || args.onlyCloud) {
|
67
|
-
|
67
|
+
try {
|
68
|
+
await resetCloudClient();
|
69
|
+
}
|
70
|
+
catch (e) {
|
71
|
+
errors.push('Failed to reset the Nx Cloud client.', e.toString());
|
72
|
+
}
|
68
73
|
}
|
69
74
|
if (errors.length > 0) {
|
70
75
|
output_1.output.error({
|
@@ -79,8 +84,10 @@ async function resetHandler(args) {
|
|
79
84
|
});
|
80
85
|
}
|
81
86
|
}
|
82
|
-
function killDaemon() {
|
83
|
-
|
87
|
+
async function killDaemon() {
|
88
|
+
if (client_1.daemonClient.enabled()) {
|
89
|
+
return client_1.daemonClient.stop();
|
90
|
+
}
|
84
91
|
}
|
85
92
|
async function resetCloudClient() {
|
86
93
|
// Remove nx cloud marker files. This helps if the use happens to run `nx-cloud start-ci-run` or
|
@@ -81,9 +81,9 @@ function withRunOptions(yargs) {
|
|
81
81
|
default: false,
|
82
82
|
})
|
83
83
|
.option('skipSync', {
|
84
|
+
describe: 'Skips running the sync generators associated with the tasks.',
|
84
85
|
type: 'boolean',
|
85
|
-
|
86
|
-
hidden: true,
|
86
|
+
default: false,
|
87
87
|
})
|
88
88
|
.options('cloud', {
|
89
89
|
type: 'boolean',
|