nx 18.2.2 → 18.2.3
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/report/report.d.ts +3 -0
- package/src/command-line/report/report.js +20 -3
- package/src/daemon/server/project-graph-incremental-recomputation.js +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +4 -1
- package/src/executors/run-commands/run-commands.impl.js +50 -3
- package/src/tasks-runner/forked-process-task-runner.js +2 -1
- package/src/tasks-runner/task-orchestrator.js +2 -0
- package/src/utils/package-json.d.ts +1 -0
- package/src/utils/package-json.js +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "18.2.
|
3
|
+
"version": "18.2.3",
|
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": "18.2.
|
69
|
+
"@nrwl/tao": "18.2.3"
|
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": "18.2.
|
85
|
-
"@nx/nx-darwin-arm64": "18.2.
|
86
|
-
"@nx/nx-linux-x64-gnu": "18.2.
|
87
|
-
"@nx/nx-linux-x64-musl": "18.2.
|
88
|
-
"@nx/nx-win32-x64-msvc": "18.2.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "18.2.
|
90
|
-
"@nx/nx-linux-arm64-musl": "18.2.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "18.2.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "18.2.
|
93
|
-
"@nx/nx-freebsd-x64": "18.2.
|
84
|
+
"@nx/nx-darwin-x64": "18.2.3",
|
85
|
+
"@nx/nx-darwin-arm64": "18.2.3",
|
86
|
+
"@nx/nx-linux-x64-gnu": "18.2.3",
|
87
|
+
"@nx/nx-linux-x64-musl": "18.2.3",
|
88
|
+
"@nx/nx-win32-x64-msvc": "18.2.3",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "18.2.3",
|
90
|
+
"@nx/nx-linux-arm64-musl": "18.2.3",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "18.2.3",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "18.2.3",
|
93
|
+
"@nx/nx-freebsd-x64": "18.2.3"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PackageManager } from '../../utils/package-manager';
|
2
2
|
import { PackageJson } from '../../utils/package-json';
|
3
|
+
import { NxJsonConfiguration } from '../../config/nx-json';
|
3
4
|
export declare const packagesWeCareAbout: string[];
|
4
5
|
export declare const patternsWeIgnoreInCommunityReport: Array<string | RegExp>;
|
5
6
|
/**
|
@@ -16,6 +17,7 @@ export interface ReportData {
|
|
16
17
|
pmVersion: string;
|
17
18
|
localPlugins: string[];
|
18
19
|
communityPlugins: PackageJson[];
|
20
|
+
registeredPlugins: string[];
|
19
21
|
packageVersionsWeCareAbout: {
|
20
22
|
package: string;
|
21
23
|
version: string;
|
@@ -41,6 +43,7 @@ interface OutOfSyncPackageGroup {
|
|
41
43
|
}
|
42
44
|
export declare function findMisalignedPackagesForPackage(base: PackageJson): undefined | OutOfSyncPackageGroup;
|
43
45
|
export declare function findInstalledCommunityPlugins(): PackageJson[];
|
46
|
+
export declare function findRegisteredPluginsBeingUsed(nxJson: NxJsonConfiguration): string[];
|
44
47
|
export declare function findInstalledPackagesWeCareAbout(): {
|
45
48
|
package: string;
|
46
49
|
version: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.findInstalledPackagesWeCareAbout = exports.findInstalledCommunityPlugins = exports.findMisalignedPackagesForPackage = exports.getReportData = exports.reportHandler = exports.patternsWeIgnoreInCommunityReport = exports.packagesWeCareAbout = void 0;
|
3
|
+
exports.findInstalledPackagesWeCareAbout = exports.findRegisteredPluginsBeingUsed = exports.findInstalledCommunityPlugins = exports.findMisalignedPackagesForPackage = exports.getReportData = exports.reportHandler = exports.patternsWeIgnoreInCommunityReport = exports.packagesWeCareAbout = void 0;
|
4
4
|
const chalk = require("chalk");
|
5
5
|
const output_1 = require("../../utils/output");
|
6
6
|
const path_1 = require("path");
|
@@ -36,7 +36,7 @@ const LINE_SEPARATOR = '---------------------------------------';
|
|
36
36
|
*
|
37
37
|
*/
|
38
38
|
async function reportHandler() {
|
39
|
-
const { pm, pmVersion, localPlugins, communityPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData();
|
39
|
+
const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData();
|
40
40
|
const bodyLines = [
|
41
41
|
`Node : ${process.versions.node}`,
|
42
42
|
`OS : ${process.platform}-${process.arch}`,
|
@@ -47,6 +47,13 @@ async function reportHandler() {
|
|
47
47
|
packageVersionsWeCareAbout.forEach((p) => {
|
48
48
|
bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
|
49
49
|
});
|
50
|
+
if (registeredPlugins.length) {
|
51
|
+
bodyLines.push(LINE_SEPARATOR);
|
52
|
+
bodyLines.push('Registered Plugins:');
|
53
|
+
for (const plugin of registeredPlugins) {
|
54
|
+
bodyLines.push(`${chalk.green(plugin)}`);
|
55
|
+
}
|
56
|
+
}
|
50
57
|
if (communityPlugins.length) {
|
51
58
|
bodyLines.push(LINE_SEPARATOR);
|
52
59
|
padding = Math.max(...communityPlugins.map((x) => x.name.length)) + 1;
|
@@ -86,8 +93,10 @@ exports.reportHandler = reportHandler;
|
|
86
93
|
async function getReportData() {
|
87
94
|
const pm = (0, package_manager_1.detectPackageManager)();
|
88
95
|
const pmVersion = (0, package_manager_1.getPackageManagerVersion)(pm);
|
89
|
-
const
|
96
|
+
const nxJson = (0, nx_json_1.readNxJson)();
|
97
|
+
const localPlugins = await findLocalPlugins(nxJson);
|
90
98
|
const communityPlugins = findInstalledCommunityPlugins();
|
99
|
+
const registeredPlugins = findRegisteredPluginsBeingUsed(nxJson);
|
91
100
|
let projectGraphError = null;
|
92
101
|
if (isNativeAvailable()) {
|
93
102
|
try {
|
@@ -114,6 +123,7 @@ async function getReportData() {
|
|
114
123
|
pmVersion,
|
115
124
|
localPlugins,
|
116
125
|
communityPlugins,
|
126
|
+
registeredPlugins,
|
117
127
|
packageVersionsWeCareAbout,
|
118
128
|
outOfSyncPackageGroup,
|
119
129
|
projectGraphError,
|
@@ -178,6 +188,13 @@ function findInstalledCommunityPlugins() {
|
|
178
188
|
: pattern.test(dep.name)));
|
179
189
|
}
|
180
190
|
exports.findInstalledCommunityPlugins = findInstalledCommunityPlugins;
|
191
|
+
function findRegisteredPluginsBeingUsed(nxJson) {
|
192
|
+
if (!nxJson.plugins) {
|
193
|
+
return [];
|
194
|
+
}
|
195
|
+
return nxJson.plugins.map((plugin) => typeof plugin === 'object' ? plugin.plugin : plugin);
|
196
|
+
}
|
197
|
+
exports.findRegisteredPluginsBeingUsed = findRegisteredPluginsBeingUsed;
|
181
198
|
function findInstalledPackagesWeCareAbout() {
|
182
199
|
const packagesWeMayCareAbout = {};
|
183
200
|
// TODO (v19): Remove workaround for hiding @nrwl packages when matching @nx package is found.
|
@@ -162,7 +162,7 @@ async function processFilesAndCreateAndSerializeProjectGraph() {
|
|
162
162
|
const errors = [...(projectConfigurationsError?.errors ?? [])];
|
163
163
|
if (g.error) {
|
164
164
|
if (g.error instanceof build_project_graph_1.CreateDependenciesError) {
|
165
|
-
errors.
|
165
|
+
errors.push(...g.error.errors);
|
166
166
|
}
|
167
167
|
else {
|
168
168
|
return {
|
@@ -39,10 +39,13 @@ export interface NormalizedRunCommandsOptions extends RunCommandsOptions {
|
|
39
39
|
parsedArgs: {
|
40
40
|
[k: string]: any;
|
41
41
|
};
|
42
|
+
unparsedCommandArgs?: {
|
43
|
+
[k: string]: string;
|
44
|
+
};
|
42
45
|
args?: string;
|
43
46
|
}
|
44
47
|
export default function (options: RunCommandsOptions, context: ExecutorContext): Promise<{
|
45
48
|
success: boolean;
|
46
49
|
terminalOutput: string;
|
47
50
|
}>;
|
48
|
-
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions'>, forwardAllArgs: boolean): string;
|
51
|
+
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
|
@@ -129,6 +129,7 @@ function normalizeOptions(options) {
|
|
129
129
|
.filter((p) => propKeys.indexOf(p) === -1 && unparsedCommandArgs[p] === undefined)
|
130
130
|
.reduce((m, c) => ((m[c] = options[c]), m), {});
|
131
131
|
options.parsedArgs = parseArgs(unparsedCommandArgs, options.unknownOptions, options.args);
|
132
|
+
options.unparsedCommandArgs = unparsedCommandArgs;
|
132
133
|
options.commands.forEach((c) => {
|
133
134
|
c.command = interpolateArgsIntoCommand(c.command, options, c.forwardAllArgs ?? true);
|
134
135
|
});
|
@@ -162,12 +163,15 @@ async function createProcess(pseudoTerminal, commandConfig, readyWhen, color, cw
|
|
162
163
|
!commandConfig.prefix &&
|
163
164
|
!isParallel &&
|
164
165
|
usePty) {
|
166
|
+
let terminalOutput = chalk.dim('> ') + commandConfig.command + '\r\n\r\n';
|
167
|
+
if (streamOutput) {
|
168
|
+
process.stdout.write(terminalOutput);
|
169
|
+
}
|
165
170
|
const cp = pseudoTerminal.runCommand(commandConfig.command, {
|
166
171
|
cwd,
|
167
172
|
jsEnv: env,
|
168
173
|
quiet: !streamOutput,
|
169
174
|
});
|
170
|
-
let terminalOutput = '';
|
171
175
|
return new Promise((res) => {
|
172
176
|
cp.onOutput((output) => {
|
173
177
|
terminalOutput += output;
|
@@ -188,7 +192,10 @@ async function createProcess(pseudoTerminal, commandConfig, readyWhen, color, cw
|
|
188
192
|
return nodeProcess(commandConfig, cwd, env, readyWhen, streamOutput);
|
189
193
|
}
|
190
194
|
function nodeProcess(commandConfig, cwd, env, readyWhen, streamOutput = true) {
|
191
|
-
let terminalOutput = '';
|
195
|
+
let terminalOutput = chalk.dim('> ') + commandConfig.command + '\r\n\r\n';
|
196
|
+
if (streamOutput) {
|
197
|
+
process.stdout.write(terminalOutput);
|
198
|
+
}
|
192
199
|
return new Promise((res) => {
|
193
200
|
const childProcess = (0, child_process_1.exec)(commandConfig.command, {
|
194
201
|
maxBuffer: exports.LARGE_BUFFER,
|
@@ -297,7 +304,10 @@ function interpolateArgsIntoCommand(command, opts, forwardAllArgs) {
|
|
297
304
|
args += ` ${opts.args}`;
|
298
305
|
}
|
299
306
|
if (opts.__unparsed__?.length > 0) {
|
300
|
-
|
307
|
+
const filterdParsedOptions = filterPropKeysFromUnParsedOptions(opts.__unparsed__, opts.unparsedCommandArgs);
|
308
|
+
if (filterdParsedOptions.length > 0) {
|
309
|
+
args += ` ${filterdParsedOptions.join(' ')}`;
|
310
|
+
}
|
301
311
|
}
|
302
312
|
return `${command}${args}`;
|
303
313
|
}
|
@@ -314,3 +324,40 @@ function parseArgs(unparsedCommandArgs, unknownOptions, args) {
|
|
314
324
|
configuration: { 'camel-case-expansion': false },
|
315
325
|
});
|
316
326
|
}
|
327
|
+
/**
|
328
|
+
* This function filters out the prop keys from the unparsed options
|
329
|
+
* @param __unparsed__ e.g. ['--prop1', 'value1', '--prop2=value2', '--args=test']
|
330
|
+
* @param unparsedCommandArgs e.g. { prop1: 'value1', prop2: 'value2', args: 'test'}
|
331
|
+
* @returns filtered options that are not part of the propKeys array e.g. ['--prop1', 'value1', '--prop2=value2']
|
332
|
+
*/
|
333
|
+
function filterPropKeysFromUnParsedOptions(__unparsed__, unparsedCommandArgs = {}) {
|
334
|
+
const parsedOptions = [];
|
335
|
+
for (let index = 0; index < __unparsed__.length; index++) {
|
336
|
+
const element = __unparsed__[index];
|
337
|
+
if (element.startsWith('--')) {
|
338
|
+
const key = element.replace('--', '');
|
339
|
+
if (element.includes('=')) {
|
340
|
+
if (!propKeys.includes(key.split('=')[0].split('.')[0])) {
|
341
|
+
// check if the key is part of the propKeys array
|
342
|
+
parsedOptions.push(element);
|
343
|
+
}
|
344
|
+
}
|
345
|
+
else {
|
346
|
+
// check if the next element is a value for the key
|
347
|
+
if (propKeys.includes(key)) {
|
348
|
+
if (index + 1 < __unparsed__.length &&
|
349
|
+
__unparsed__[index + 1] === unparsedCommandArgs[key]) {
|
350
|
+
index++; // skip the next element
|
351
|
+
}
|
352
|
+
}
|
353
|
+
else {
|
354
|
+
parsedOptions.push(element);
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
else {
|
359
|
+
parsedOptions.push(element);
|
360
|
+
}
|
361
|
+
}
|
362
|
+
return parsedOptions;
|
363
|
+
}
|
@@ -132,7 +132,7 @@ class ForkedProcessTaskRunner {
|
|
132
132
|
});
|
133
133
|
}
|
134
134
|
}
|
135
|
-
async forkProcessWithPseudoTerminal(task, { streamOutput, taskGraph, env, }) {
|
135
|
+
async forkProcessWithPseudoTerminal(task, { temporaryOutputPath, streamOutput, taskGraph, env, }) {
|
136
136
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
137
137
|
if (streamOutput) {
|
138
138
|
output_1.output.logCommand(args.join(' '));
|
@@ -160,6 +160,7 @@ class ForkedProcessTaskRunner {
|
|
160
160
|
if (code >= 128) {
|
161
161
|
process.exit(code);
|
162
162
|
}
|
163
|
+
this.writeTerminalOutput(temporaryOutputPath, terminalOutput);
|
163
164
|
res({
|
164
165
|
code,
|
165
166
|
terminalOutput,
|
@@ -4,6 +4,7 @@ exports.TaskOrchestrator = void 0;
|
|
4
4
|
const events_1 = require("events");
|
5
5
|
const perf_hooks_1 = require("perf_hooks");
|
6
6
|
const path_1 = require("path");
|
7
|
+
const fs_1 = require("fs");
|
7
8
|
const run_commands_impl_1 = require("../executors/run-commands/run-commands.impl");
|
8
9
|
const forked_process_task_runner_1 = require("./forked-process-task-runner");
|
9
10
|
const cache_1 = require("./cache");
|
@@ -238,6 +239,7 @@ class TaskOrchestrator {
|
|
238
239
|
if (!streamOutput) {
|
239
240
|
this.options.lifeCycle.printTaskTerminalOutput(task, status, terminalOutput);
|
240
241
|
}
|
242
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
241
243
|
results.push({
|
242
244
|
task,
|
243
245
|
status,
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readModulePackageJson = exports.readModulePackageJsonWithoutFallbacks = exports.readTargetsFromPackageJson = exports.buildTargetFromScript = exports.readNxMigrateConfig = exports.normalizePackageGroup = void 0;
|
4
4
|
const fs_1 = require("fs");
|
5
5
|
const path_1 = require("path");
|
6
|
+
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
6
7
|
const fileutils_1 = require("./fileutils");
|
7
8
|
const installation_directory_1 = require("./installation-directory");
|
8
|
-
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
9
9
|
function normalizePackageGroup(packageGroup) {
|
10
10
|
return Array.isArray(packageGroup)
|
11
11
|
? packageGroup.map((x) => typeof x === 'string' ? { package: x, version: '*' } : x)
|