nx 19.1.0-canary.20240511-f7dcf43 → 19.1.0-canary.20240515-a2a7d7e
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/affected/affected.d.ts +4 -1
- package/src/command-line/affected/affected.js +5 -2
- package/src/command-line/deprecated/command-objects.d.ts +9 -0
- package/src/command-line/deprecated/command-objects.js +41 -0
- package/src/command-line/examples.js +0 -48
- package/src/command-line/nx-commands.js +3 -0
- package/src/command-line/release/publish.js +10 -7
- package/src/command-line/run/run-one.js +4 -1
- package/src/command-line/run/run.js +10 -2
- package/src/command-line/run-many/run-many.js +4 -1
- package/src/daemon/client/client.js +5 -3
- package/src/daemon/server/server.js +2 -2
- package/src/daemon/server/watcher.js +4 -1
- package/src/daemon/socket-utils.d.ts +2 -2
- package/src/daemon/socket-utils.js +9 -8
- package/src/daemon/tmp-dir.d.ts +6 -2
- package/src/daemon/tmp-dir.js +6 -5
- package/src/executors/run-commands/run-commands.impl.js +3 -1
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +8 -1
- package/src/project-graph/affected/locators/workspace-projects.js +1 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +1 -1
- package/src/tasks-runner/pseudo-terminal.js +1 -1
- package/src/utils/find-matching-projects.js +13 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.1.0-canary.
|
3
|
+
"version": "19.1.0-canary.20240515-a2a7d7e",
|
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.1.0-canary.
|
69
|
+
"@nrwl/tao": "19.1.0-canary.20240515-a2a7d7e"
|
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.1.0-canary.
|
85
|
-
"@nx/nx-darwin-arm64": "19.1.0-canary.
|
86
|
-
"@nx/nx-linux-x64-gnu": "19.1.0-canary.
|
87
|
-
"@nx/nx-linux-x64-musl": "19.1.0-canary.
|
88
|
-
"@nx/nx-win32-x64-msvc": "19.1.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "19.1.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "19.1.0-canary.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "19.1.0-canary.
|
93
|
-
"@nx/nx-freebsd-x64": "19.1.0-canary.
|
84
|
+
"@nx/nx-darwin-x64": "19.1.0-canary.20240515-a2a7d7e",
|
85
|
+
"@nx/nx-darwin-arm64": "19.1.0-canary.20240515-a2a7d7e",
|
86
|
+
"@nx/nx-linux-x64-gnu": "19.1.0-canary.20240515-a2a7d7e",
|
87
|
+
"@nx/nx-linux-x64-musl": "19.1.0-canary.20240515-a2a7d7e",
|
88
|
+
"@nx/nx-win32-x64-msvc": "19.1.0-canary.20240515-a2a7d7e",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240515-a2a7d7e",
|
90
|
+
"@nx/nx-linux-arm64-musl": "19.1.0-canary.20240515-a2a7d7e",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240515-a2a7d7e",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240515-a2a7d7e",
|
93
|
+
"@nx/nx-freebsd-x64": "19.1.0-canary.20240515-a2a7d7e"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
@@ -3,5 +3,8 @@ import { ProjectGraph, ProjectGraphProjectNode } from '../../config/project-grap
|
|
3
3
|
import { TargetDependencyConfig } from '../../config/workspace-json-project-json';
|
4
4
|
export declare function affected(command: 'graph' | 'print-affected' | 'affected', args: {
|
5
5
|
[k: string]: any;
|
6
|
-
}, extraTargetDependencies?: Record<string, (TargetDependencyConfig | string)[]
|
6
|
+
}, extraTargetDependencies?: Record<string, (TargetDependencyConfig | string)[]>, extraOptions?: {
|
7
|
+
excludeTaskDependencies: boolean;
|
8
|
+
loadDotEnvFiles: boolean;
|
9
|
+
}): Promise<void>;
|
7
10
|
export declare function getAffectedGraphNodes(nxArgs: NxArgs, projectGraph: ProjectGraph): Promise<ProjectGraphProjectNode[]>;
|
@@ -15,7 +15,10 @@ const workspace_configuration_check_1 = require("../../utils/workspace-configura
|
|
15
15
|
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
16
16
|
const graph_1 = require("../graph/graph");
|
17
17
|
const all_file_data_1 = require("../../utils/all-file-data");
|
18
|
-
async function affected(command, args, extraTargetDependencies = {}
|
18
|
+
async function affected(command, args, extraTargetDependencies = {}, extraOptions = {
|
19
|
+
excludeTaskDependencies: false,
|
20
|
+
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
21
|
+
}) {
|
19
22
|
perf_hooks_1.performance.mark('code-loading:end');
|
20
23
|
perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
|
21
24
|
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
@@ -46,7 +49,7 @@ async function affected(command, args, extraTargetDependencies = {}) {
|
|
46
49
|
}, projectNames);
|
47
50
|
}
|
48
51
|
else {
|
49
|
-
const status = await (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies,
|
52
|
+
const status = await (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
50
53
|
process.exit(status);
|
51
54
|
}
|
52
55
|
break;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { CommandModule } from 'yargs';
|
2
|
+
/**
|
3
|
+
* @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.'
|
4
|
+
*/
|
5
|
+
export declare const yargsAffectedGraphCommand: CommandModule;
|
6
|
+
/**
|
7
|
+
* @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.'
|
8
|
+
*/
|
9
|
+
export declare const yargsPrintAffectedCommand: CommandModule;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.yargsPrintAffectedCommand = exports.yargsAffectedGraphCommand = void 0;
|
4
|
+
const params_1 = require("../../utils/params");
|
5
|
+
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
+
const affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command has been removed in Nx 19.';
|
7
|
+
const printAffectedDeprecationMessage = 'Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command has been removed in Nx 19.';
|
8
|
+
/**
|
9
|
+
* @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.'
|
10
|
+
*/
|
11
|
+
exports.yargsAffectedGraphCommand = {
|
12
|
+
command: 'affected:graph',
|
13
|
+
describe: false,
|
14
|
+
aliases: ['affected:dep-graph'],
|
15
|
+
builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0, shared_options_1.withDepGraphOptions)(yargs)),
|
16
|
+
handler: (args) => (0, params_1.handleErrors)(false, () => {
|
17
|
+
throw new Error(affectedGraphDeprecationMessage);
|
18
|
+
}),
|
19
|
+
deprecated: affectedGraphDeprecationMessage,
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.'
|
23
|
+
*/
|
24
|
+
exports.yargsPrintAffectedCommand = {
|
25
|
+
command: 'print-affected',
|
26
|
+
describe: false,
|
27
|
+
builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTargetAndConfigurationOption)(yargs, false))
|
28
|
+
.option('select', {
|
29
|
+
type: 'string',
|
30
|
+
describe: 'Select the subset of the returned json document (e.g., --select=projects)',
|
31
|
+
})
|
32
|
+
.option('type', {
|
33
|
+
type: 'string',
|
34
|
+
choices: ['app', 'lib'],
|
35
|
+
describe: 'Select the type of projects to be returned (e.g., --type=app)',
|
36
|
+
}),
|
37
|
+
handler: (args) => (0, params_1.handleErrors)(false, () => {
|
38
|
+
throw new Error(printAffectedDeprecationMessage);
|
39
|
+
}),
|
40
|
+
deprecated: printAffectedDeprecationMessage,
|
41
|
+
};
|
@@ -2,28 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.examples = void 0;
|
4
4
|
exports.examples = {
|
5
|
-
'print-affected': [
|
6
|
-
{
|
7
|
-
command: 'print-affected',
|
8
|
-
description: 'Print information about affected projects and the project graph',
|
9
|
-
},
|
10
|
-
{
|
11
|
-
command: 'print-affected --base=main --head=HEAD',
|
12
|
-
description: 'Print information about the projects affected by the changes between main and HEAD (e.g,. PR)',
|
13
|
-
},
|
14
|
-
{
|
15
|
-
command: 'print-affected -t test',
|
16
|
-
description: 'Prints information about the affected projects and a list of tasks to test them',
|
17
|
-
},
|
18
|
-
{
|
19
|
-
command: 'print-affected -t build --select=projects',
|
20
|
-
description: 'Prints the projects property from the print-affected output',
|
21
|
-
},
|
22
|
-
{
|
23
|
-
command: 'print-affected -t build --select=tasks.target.project',
|
24
|
-
description: 'Prints the tasks.target.project property from the print-affected output',
|
25
|
-
},
|
26
|
-
],
|
27
5
|
affected: [
|
28
6
|
{
|
29
7
|
command: 'affected -t custom-target',
|
@@ -166,32 +144,6 @@ exports.examples = {
|
|
166
144
|
description: 'Watch for changes to project graph and update in-browser',
|
167
145
|
},
|
168
146
|
],
|
169
|
-
'affected:graph': [
|
170
|
-
{
|
171
|
-
command: 'affected:graph --files=libs/mylib/src/index.ts',
|
172
|
-
description: 'Open the project graph of the workspace in the browser, and highlight the projects affected by changing the index.ts file',
|
173
|
-
},
|
174
|
-
{
|
175
|
-
command: 'affected:graph --base=main --head=HEAD',
|
176
|
-
description: 'Open the project graph of the workspace in the browser, and highlight the projects affected by the changes between main and HEAD (e.g., PR)',
|
177
|
-
},
|
178
|
-
{
|
179
|
-
command: 'affected:graph --base=main --head=HEAD --file=output.json',
|
180
|
-
description: 'Save the project graph of the workspace in a json file, and highlight the projects affected by the changes between main and HEAD (e.g., PR)',
|
181
|
-
},
|
182
|
-
{
|
183
|
-
command: 'affected:graph --base=main --head=HEAD --file=output.html',
|
184
|
-
description: 'Generate a static website with project graph data in an html file, highlighting the projects affected by the changes between main and HEAD (e.g., PR)',
|
185
|
-
},
|
186
|
-
{
|
187
|
-
command: 'affected:graph --base=main~1 --head=main',
|
188
|
-
description: 'Open the project graph of the workspace in the browser, and highlight the projects affected by the last commit on main',
|
189
|
-
},
|
190
|
-
{
|
191
|
-
command: 'affected:graph --exclude=project-one,project-two',
|
192
|
-
description: 'Open the project graph of the workspace in the browser, highlight the projects affected, but exclude project-one and project-two',
|
193
|
-
},
|
194
|
-
],
|
195
147
|
list: [
|
196
148
|
{
|
197
149
|
command: 'list',
|
@@ -23,6 +23,7 @@ const command_object_17 = require("./watch/command-object");
|
|
23
23
|
const command_object_18 = require("./reset/command-object");
|
24
24
|
const command_object_19 = require("./release/command-object");
|
25
25
|
const command_object_20 = require("./add/command-object");
|
26
|
+
const command_objects_1 = require("./deprecated/command-objects");
|
26
27
|
// Ensure that the output takes up the available width of the terminal.
|
27
28
|
yargs.wrap(yargs.terminalWidth());
|
28
29
|
exports.parserConfiguration = {
|
@@ -45,6 +46,7 @@ exports.commandsObject = yargs
|
|
45
46
|
.command(command_object_1.yargsAffectedE2ECommand)
|
46
47
|
.command(command_object_1.yargsAffectedLintCommand)
|
47
48
|
.command(command_object_1.yargsAffectedTestCommand)
|
49
|
+
.command(command_objects_1.yargsAffectedGraphCommand)
|
48
50
|
.command(command_object_2.yargsConnectCommand)
|
49
51
|
.command(command_object_3.yargsDaemonCommand)
|
50
52
|
.command(command_object_4.yargsDepGraphCommand)
|
@@ -57,6 +59,7 @@ exports.commandsObject = yargs
|
|
57
59
|
.command(command_object_9.yargsListCommand)
|
58
60
|
.command(command_object_10.yargsMigrateCommand)
|
59
61
|
.command(command_object_11.yargsNewCommand)
|
62
|
+
.command(command_objects_1.yargsPrintAffectedCommand)
|
60
63
|
.command(command_object_19.yargsReleaseCommand)
|
61
64
|
.command(command_object_12.yargsRepairCommand)
|
62
65
|
.command(command_object_13.yargsReportCommand)
|
@@ -54,7 +54,10 @@ async function releasePublish(args, isCLI = false) {
|
|
54
54
|
* Run publishing for all remaining release groups and filtered projects within them
|
55
55
|
*/
|
56
56
|
for (const releaseGroup of releaseGroups) {
|
57
|
-
const status = await runPublishOnProjects(_args, projectGraph, nxJson, Array.from(releaseGroupToFilteredProjects.get(releaseGroup)),
|
57
|
+
const status = await runPublishOnProjects(_args, projectGraph, nxJson, Array.from(releaseGroupToFilteredProjects.get(releaseGroup)), isCLI, {
|
58
|
+
excludeTaskDependencies: shouldExcludeTaskDependencies,
|
59
|
+
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
60
|
+
});
|
58
61
|
if (status !== 0) {
|
59
62
|
overallExitStatus = status || 1;
|
60
63
|
}
|
@@ -65,7 +68,10 @@ async function releasePublish(args, isCLI = false) {
|
|
65
68
|
* Run publishing for all remaining release groups
|
66
69
|
*/
|
67
70
|
for (const releaseGroup of releaseGroups) {
|
68
|
-
const status = await runPublishOnProjects(_args, projectGraph, nxJson, releaseGroup.projects,
|
71
|
+
const status = await runPublishOnProjects(_args, projectGraph, nxJson, releaseGroup.projects, isCLI, {
|
72
|
+
excludeTaskDependencies: shouldExcludeTaskDependencies,
|
73
|
+
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
74
|
+
});
|
69
75
|
if (status !== 0) {
|
70
76
|
overallExitStatus = status || 1;
|
71
77
|
}
|
@@ -73,7 +79,7 @@ async function releasePublish(args, isCLI = false) {
|
|
73
79
|
return overallExitStatus;
|
74
80
|
}
|
75
81
|
exports.releasePublish = releasePublish;
|
76
|
-
async function runPublishOnProjects(args, projectGraph, nxJson, projectNames,
|
82
|
+
async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, isCLI, extraOptions) {
|
77
83
|
const projectsToRun = projectNames.map((projectName) => projectGraph.nodes[projectName]);
|
78
84
|
const overrides = (0, command_line_utils_1.createOverrides)(args.__overrides_unparsed__);
|
79
85
|
if (args.registry) {
|
@@ -131,10 +137,7 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, sh
|
|
131
137
|
targets: [requiredTargetName],
|
132
138
|
outputStyle: 'static',
|
133
139
|
...args,
|
134
|
-
}, overrides, null, {},
|
135
|
-
excludeTaskDependencies: shouldExcludeTaskDependencies,
|
136
|
-
loadDotEnvFiles: true,
|
137
|
-
});
|
140
|
+
}, overrides, null, {}, extraOptions);
|
138
141
|
if (status !== 0) {
|
139
142
|
// In order to not add noise to the overall CLI output, do not throw an additional error
|
140
143
|
if (isCLI) {
|
@@ -13,7 +13,10 @@ const configuration_1 = require("../../config/configuration");
|
|
13
13
|
const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
|
14
14
|
const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
|
15
15
|
const graph_1 = require("../graph/graph");
|
16
|
-
async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
16
|
+
async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
17
|
+
excludeTaskDependencies: false,
|
18
|
+
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
19
|
+
}) {
|
17
20
|
perf_hooks_1.performance.mark('code-loading:end');
|
18
21
|
perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
|
19
22
|
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.run = exports.printTargetRunHelp = exports.runExecutor = exports.validateProject = exports.printRunHelp = void 0;
|
4
|
+
const npm_run_path_1 = require("npm-run-path");
|
4
5
|
const params_1 = require("../../utils/params");
|
5
6
|
const print_help_1 = require("../../utils/print-help");
|
6
7
|
const path_1 = require("path");
|
@@ -68,17 +69,24 @@ async function printTargetRunHelpInternal({ project, target }, root, projectsCon
|
|
68
69
|
targetConfig.options.command) {
|
69
70
|
const command = targetConfig.options.command.split(' ')[0];
|
70
71
|
const helpCommand = `${command} --help`;
|
72
|
+
const localEnv = (0, npm_run_path_1.env)();
|
73
|
+
const env = {
|
74
|
+
...process.env,
|
75
|
+
...localEnv,
|
76
|
+
};
|
71
77
|
if (pseudo_terminal_1.PseudoTerminal.isSupported()) {
|
72
78
|
const terminal = (0, pseudo_terminal_1.getPseudoTerminal)();
|
73
79
|
await new Promise(() => {
|
74
|
-
const cp = terminal.runCommand(helpCommand);
|
80
|
+
const cp = terminal.runCommand(helpCommand, { jsEnv: env });
|
75
81
|
cp.onExit((code) => {
|
76
82
|
process.exit(code);
|
77
83
|
});
|
78
84
|
});
|
79
85
|
}
|
80
86
|
else {
|
81
|
-
const cp = (0, child_process_1.exec)(helpCommand
|
87
|
+
const cp = (0, child_process_1.exec)(helpCommand, {
|
88
|
+
env,
|
89
|
+
});
|
82
90
|
cp.on('exit', (code) => {
|
83
91
|
process.exit(code);
|
84
92
|
});
|
@@ -13,7 +13,10 @@ const output_1 = require("../../utils/output");
|
|
13
13
|
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
14
14
|
const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
|
15
15
|
const graph_1 = require("../graph/graph");
|
16
|
-
async function runMany(args, extraTargetDependencies = {}, extraOptions = {
|
16
|
+
async function runMany(args, extraTargetDependencies = {}, extraOptions = {
|
17
|
+
excludeTaskDependencies: false,
|
18
|
+
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
19
|
+
}) {
|
17
20
|
perf_hooks_1.performance.mark('code-loading:end');
|
18
21
|
perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
|
19
22
|
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
@@ -19,6 +19,7 @@ const nx_json_1 = require("../../config/nx-json");
|
|
19
19
|
const daemon_socket_messenger_1 = require("./daemon-socket-messenger");
|
20
20
|
const cache_1 = require("../cache");
|
21
21
|
const error_types_1 = require("../../project-graph/error-types");
|
22
|
+
const dotenv_1 = require("../../utils/dotenv");
|
22
23
|
const DAEMON_ENV_SETTINGS = {
|
23
24
|
NX_PROJECT_GLOB_CACHE: 'false',
|
24
25
|
NX_CACHE_PROJECTS_CONFIG: 'false',
|
@@ -36,6 +37,7 @@ class DaemonClient {
|
|
36
37
|
this._daemonReady = null;
|
37
38
|
this._out = null;
|
38
39
|
this._err = null;
|
40
|
+
(0, dotenv_1.loadRootEnvFiles)(workspace_root_1.workspaceRoot);
|
39
41
|
try {
|
40
42
|
this.nxJson = (0, configuration_1.readNxJson)();
|
41
43
|
}
|
@@ -139,7 +141,7 @@ class DaemonClient {
|
|
139
141
|
}
|
140
142
|
let messenger;
|
141
143
|
await this.queue.sendToQueue(() => {
|
142
|
-
messenger = new daemon_socket_messenger_1.DaemonSocketMessenger((0, net_1.connect)(socket_utils_1.
|
144
|
+
messenger = new daemon_socket_messenger_1.DaemonSocketMessenger((0, net_1.connect)((0, socket_utils_1.getFullOsSocketPath)())).listen((message) => {
|
143
145
|
try {
|
144
146
|
const parsedMessage = JSON.parse(message);
|
145
147
|
callback(null, parsedMessage);
|
@@ -184,7 +186,7 @@ class DaemonClient {
|
|
184
186
|
async isServerAvailable() {
|
185
187
|
return new Promise((resolve) => {
|
186
188
|
try {
|
187
|
-
const socket = (0, net_1.connect)(socket_utils_1.
|
189
|
+
const socket = (0, net_1.connect)((0, socket_utils_1.getFullOsSocketPath)(), () => {
|
188
190
|
socket.destroy();
|
189
191
|
resolve(true);
|
190
192
|
});
|
@@ -201,7 +203,7 @@ class DaemonClient {
|
|
201
203
|
return this.queue.sendToQueue(() => this.sendMessageToDaemon(messageToDaemon));
|
202
204
|
}
|
203
205
|
setUpConnection() {
|
204
|
-
this.socketMessenger = new daemon_socket_messenger_1.DaemonSocketMessenger((0, net_1.connect)(socket_utils_1.
|
206
|
+
this.socketMessenger = new daemon_socket_messenger_1.DaemonSocketMessenger((0, net_1.connect)((0, socket_utils_1.getFullOsSocketPath)())).listen((message) => this.handleMessage(message), () => {
|
205
207
|
// it's ok for the daemon to terminate if the client doesn't wait on
|
206
208
|
// any messages from the daemon
|
207
209
|
if (this.queue.isEmpty()) {
|
@@ -273,9 +273,9 @@ async function startServer() {
|
|
273
273
|
}
|
274
274
|
return new Promise(async (resolve, reject) => {
|
275
275
|
try {
|
276
|
-
server.listen(socket_utils_1.
|
276
|
+
server.listen((0, socket_utils_1.getFullOsSocketPath)(), async () => {
|
277
277
|
try {
|
278
|
-
logger_1.serverLogger.log(`Started listening on: ${socket_utils_1.
|
278
|
+
logger_1.serverLogger.log(`Started listening on: ${(0, socket_utils_1.getFullOsSocketPath)()}`);
|
279
279
|
// this triggers the storage of the lock file hash
|
280
280
|
daemonIsOutdated();
|
281
281
|
if (!(0, shutdown_utils_1.getWatcherInstance)()) {
|
@@ -8,7 +8,10 @@ const shutdown_utils_1 = require("./shutdown-utils");
|
|
8
8
|
const path_2 = require("../../utils/path");
|
9
9
|
const ignore_1 = require("../../utils/ignore");
|
10
10
|
const cache_1 = require("../cache");
|
11
|
-
const ALWAYS_IGNORE = [
|
11
|
+
const ALWAYS_IGNORE = [
|
12
|
+
...(0, ignore_1.getAlwaysIgnore)(workspace_root_1.workspaceRoot),
|
13
|
+
(0, socket_utils_1.getFullOsSocketPath)(),
|
14
|
+
];
|
12
15
|
async function watchWorkspace(server, cb) {
|
13
16
|
const { Watcher } = await Promise.resolve().then(() => require('../../native'));
|
14
17
|
let relativeServerProcess = (0, path_2.normalizePath)((0, path_1.relative)(workspace_root_1.workspaceRoot, cache_1.serverProcessJsonPath));
|
@@ -5,7 +5,7 @@ export declare const isWindows: boolean;
|
|
5
5
|
* See https://nodejs.org/dist/latest-v14.x/docs/api/net.html#net_identifying_paths_for_ipc_connections for a full breakdown
|
6
6
|
* of OS differences between Unix domain sockets and named pipes.
|
7
7
|
*/
|
8
|
-
export declare const
|
9
|
-
export declare const
|
8
|
+
export declare const getFullOsSocketPath: () => string;
|
9
|
+
export declare const getForkedProcessOsSocketPath: (id: string) => string;
|
10
10
|
export declare function killSocketOrPath(): void;
|
11
11
|
export declare function serializeResult(error: Error | null, serializedProjectGraph: string | null, serializedSourceMaps: string | null): string | null;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.serializeResult = exports.killSocketOrPath = exports.
|
3
|
+
exports.serializeResult = exports.killSocketOrPath = exports.getForkedProcessOsSocketPath = exports.getFullOsSocketPath = exports.isWindows = void 0;
|
4
4
|
const fs_1 = require("fs");
|
5
5
|
const os_1 = require("os");
|
6
6
|
const path_1 = require("path");
|
@@ -13,17 +13,18 @@ exports.isWindows = (0, os_1.platform)() === 'win32';
|
|
13
13
|
* See https://nodejs.org/dist/latest-v14.x/docs/api/net.html#net_identifying_paths_for_ipc_connections for a full breakdown
|
14
14
|
* of OS differences between Unix domain sockets and named pipes.
|
15
15
|
*/
|
16
|
-
|
17
|
-
? '\\\\.\\pipe\\nx\\' + (0, path_1.resolve)(tmp_dir_1.
|
18
|
-
: (0, path_1.resolve)(tmp_dir_1.
|
19
|
-
|
20
|
-
|
16
|
+
const getFullOsSocketPath = () => exports.isWindows
|
17
|
+
? '\\\\.\\pipe\\nx\\' + (0, path_1.resolve)((0, tmp_dir_1.getDaemonSocketDir)())
|
18
|
+
: (0, path_1.resolve)((0, tmp_dir_1.getDaemonSocketDir)());
|
19
|
+
exports.getFullOsSocketPath = getFullOsSocketPath;
|
20
|
+
const getForkedProcessOsSocketPath = (id) => {
|
21
|
+
let path = (0, path_1.resolve)((0, path_1.join)((0, tmp_dir_1.getSocketDir)(), 'fp' + id + '.sock'));
|
21
22
|
return exports.isWindows ? '\\\\.\\pipe\\nx\\' + (0, path_1.resolve)(path) : (0, path_1.resolve)(path);
|
22
23
|
};
|
23
|
-
exports.
|
24
|
+
exports.getForkedProcessOsSocketPath = getForkedProcessOsSocketPath;
|
24
25
|
function killSocketOrPath() {
|
25
26
|
try {
|
26
|
-
(0, fs_1.unlinkSync)(exports.
|
27
|
+
(0, fs_1.unlinkSync)((0, exports.getFullOsSocketPath)());
|
27
28
|
}
|
28
29
|
catch { }
|
29
30
|
}
|
package/src/daemon/tmp-dir.d.ts
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
export declare const DAEMON_DIR_FOR_CURRENT_WORKSPACE: string;
|
2
2
|
export declare const DAEMON_OUTPUT_LOG_FILE: string;
|
3
|
-
export declare const
|
4
|
-
export declare const DAEMON_SOCKET_PATH: string;
|
3
|
+
export declare const getDaemonSocketDir: () => string;
|
5
4
|
export declare function writeDaemonLogs(error?: string): string;
|
6
5
|
export declare function markDaemonAsDisabled(): void;
|
7
6
|
export declare function isDaemonDisabled(): boolean;
|
7
|
+
/**
|
8
|
+
* We try to create a socket file in a tmp dir, but if it doesn't work because
|
9
|
+
* for instance we don't have permissions, we create it in DAEMON_DIR_FOR_CURRENT_WORKSPACE
|
10
|
+
*/
|
11
|
+
export declare function getSocketDir(): string;
|
8
12
|
export declare function removeSocketDir(): void;
|
package/src/daemon/tmp-dir.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.removeSocketDir = exports.
|
3
|
+
exports.removeSocketDir = exports.getSocketDir = exports.isDaemonDisabled = exports.markDaemonAsDisabled = exports.writeDaemonLogs = exports.getDaemonSocketDir = exports.DAEMON_OUTPUT_LOG_FILE = exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE = void 0;
|
4
4
|
/**
|
5
5
|
* Per workspace (to avoid subtle differences and issues), we want to have a deterministic
|
6
6
|
* location within the OS's tmp directory where we write log files for background processes
|
@@ -15,10 +15,10 @@ const tmp_1 = require("tmp");
|
|
15
15
|
const workspace_root_1 = require("../utils/workspace-root");
|
16
16
|
exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE = (0, path_1.join)(cache_directory_1.projectGraphCacheDirectory, 'd');
|
17
17
|
exports.DAEMON_OUTPUT_LOG_FILE = (0, path_1.join)(exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE, 'daemon.log');
|
18
|
-
|
19
|
-
exports.DAEMON_SOCKET_PATH = (0, path_1.join)(exports.socketDir,
|
18
|
+
const getDaemonSocketDir = () => (0, path_1.join)(getSocketDir(),
|
20
19
|
// As per notes above on socket/named pipe length limitations, we keep this intentionally short
|
21
20
|
'd.sock');
|
21
|
+
exports.getDaemonSocketDir = getDaemonSocketDir;
|
22
22
|
function writeDaemonLogs(error) {
|
23
23
|
const file = (0, path_1.join)(exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE, 'daemon-error.log');
|
24
24
|
(0, fs_1.writeFileSync)(file, error);
|
@@ -49,7 +49,7 @@ function socketDirName() {
|
|
49
49
|
* We try to create a socket file in a tmp dir, but if it doesn't work because
|
50
50
|
* for instance we don't have permissions, we create it in DAEMON_DIR_FOR_CURRENT_WORKSPACE
|
51
51
|
*/
|
52
|
-
function
|
52
|
+
function getSocketDir() {
|
53
53
|
try {
|
54
54
|
const dir = process.env.NX_DAEMON_SOCKET_DIR ?? socketDirName();
|
55
55
|
(0, fs_extra_1.ensureDirSync)(dir);
|
@@ -59,9 +59,10 @@ function createSocketDir() {
|
|
59
59
|
return exports.DAEMON_DIR_FOR_CURRENT_WORKSPACE;
|
60
60
|
}
|
61
61
|
}
|
62
|
+
exports.getSocketDir = getSocketDir;
|
62
63
|
function removeSocketDir() {
|
63
64
|
try {
|
64
|
-
(0, fs_extra_1.rmSync)(
|
65
|
+
(0, fs_extra_1.rmSync)(getSocketDir(), { recursive: true, force: true });
|
65
66
|
}
|
66
67
|
catch (e) { }
|
67
68
|
}
|
@@ -44,7 +44,9 @@ const propKeys = [
|
|
44
44
|
];
|
45
45
|
async function default_1(options, context) {
|
46
46
|
registerProcessListener();
|
47
|
-
|
47
|
+
if (process.env.NX_LOAD_DOT_ENV_FILES !== 'false') {
|
48
|
+
await loadEnvVars(options.envFile);
|
49
|
+
}
|
48
50
|
const normalized = normalizeOptions(options);
|
49
51
|
if (options.readyWhen && !options.parallel) {
|
50
52
|
throw new Error('ERROR: Bad executor config for run-commands - "readyWhen" can only be used when "parallel=true".');
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const logger_1 = require("../../utils/logger");
|
3
4
|
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
4
5
|
/**
|
5
6
|
* This function escapes dollar sign in env variables
|
@@ -41,11 +42,17 @@ function parseEnvFile(tree, envFilePath) {
|
|
41
42
|
return;
|
42
43
|
}
|
43
44
|
let envFileContent = tree.read(envFilePath, 'utf-8');
|
45
|
+
if (!envFileContent) {
|
46
|
+
// envFileContent is null if we fail to read the file for any reason
|
47
|
+
// e.g. the file is not utf-8 encoded
|
48
|
+
logger_1.logger.info(`Unable to update ${envFilePath}. Nx interpolates environment variables in the form of $VAR_NAME. To escape the dollar sign, use \\$VAR_NAME.`);
|
49
|
+
return;
|
50
|
+
}
|
44
51
|
envFileContent = envFileContent
|
45
52
|
.split('\n')
|
46
53
|
.map((line) => {
|
47
54
|
line = line.trim();
|
48
|
-
if (!line.includes('$')) {
|
55
|
+
if (!line || !line.includes('$')) {
|
49
56
|
return line;
|
50
57
|
}
|
51
58
|
const declarations = line.split('=');
|
@@ -60,7 +60,7 @@ function extractFilesFromInputs(inputs, namedInputs) {
|
|
60
60
|
const globalFiles = [];
|
61
61
|
for (const input of inputs) {
|
62
62
|
if (typeof input === 'string' && input in namedInputs) {
|
63
|
-
|
63
|
+
globalFiles.push(...extractFilesFromInputs(namedInputs[input], namedInputs));
|
64
64
|
}
|
65
65
|
else if (typeof input === 'string' &&
|
66
66
|
input.startsWith('{workspaceRoot}/')) {
|
@@ -331,7 +331,7 @@ function writeCompletedTaskResultLine(line) {
|
|
331
331
|
function writeCommandOutputBlock(commandOutput) {
|
332
332
|
commandOutput = commandOutput || '';
|
333
333
|
commandOutput = commandOutput.trimStart();
|
334
|
-
const lines = commandOutput.split(
|
334
|
+
const lines = commandOutput.split(/\r?\n/);
|
335
335
|
let totalTrailingEmptyLines = 0;
|
336
336
|
for (let i = lines.length - 1; i >= 0; i--) {
|
337
337
|
if (lines[i] !== '') {
|
@@ -20,7 +20,7 @@ class PseudoTerminal {
|
|
20
20
|
}
|
21
21
|
constructor(rustPseudoTerminal) {
|
22
22
|
this.rustPseudoTerminal = rustPseudoTerminal;
|
23
|
-
this.pseudoIPCPath = (0, socket_utils_1.
|
23
|
+
this.pseudoIPCPath = (0, socket_utils_1.getForkedProcessOsSocketPath)(process.pid.toString());
|
24
24
|
this.pseudoIPC = new pseudo_ipc_1.PseudoIPCServer(this.pseudoIPCPath);
|
25
25
|
this.initialized = false;
|
26
26
|
this.setupProcessListeners();
|
@@ -22,6 +22,15 @@ function findMatchingProjects(patterns = [], projects) {
|
|
22
22
|
}
|
23
23
|
const projectNames = Object.keys(projects);
|
24
24
|
const matchedProjects = new Set();
|
25
|
+
// If the first pattern is an exclude pattern,
|
26
|
+
// we add a wildcard pattern at the first to select
|
27
|
+
// all projects, except the ones that match the exclude pattern.
|
28
|
+
// e.g. ['!tag:someTag', 'project2'] will match all projects except
|
29
|
+
// the ones with the tag 'someTag', and also match the project 'project2',
|
30
|
+
// regardless of its tags.
|
31
|
+
if (isExcludePattern(patterns[0])) {
|
32
|
+
patterns.unshift('*');
|
33
|
+
}
|
25
34
|
for (const stringPattern of patterns) {
|
26
35
|
if (!stringPattern.length) {
|
27
36
|
continue;
|
@@ -139,8 +148,11 @@ function addMatchingProjectsByTag(projectNames, projects, pattern, matchedProjec
|
|
139
148
|
}
|
140
149
|
}
|
141
150
|
}
|
151
|
+
function isExcludePattern(pattern) {
|
152
|
+
return pattern.startsWith('!');
|
153
|
+
}
|
142
154
|
function parseStringPattern(pattern, projects) {
|
143
|
-
const isExclude = pattern
|
155
|
+
const isExclude = isExcludePattern(pattern);
|
144
156
|
// Support for things like: `!{type}:value`
|
145
157
|
if (isExclude) {
|
146
158
|
pattern = pattern.substring(1);
|