nx 18.0.3 → 18.0.5
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 +14 -13
- package/src/command-line/add/add.js +3 -1
- package/src/command-line/graph/graph.js +1 -1
- package/src/command-line/init/init-v2.js +16 -11
- package/src/command-line/migrate/command-object.js +17 -2
- package/src/command-line/migrate/migrate.js +13 -1
- package/src/command-line/release/changelog.d.ts +16 -1
- package/src/command-line/release/changelog.js +104 -198
- package/src/command-line/release/command-object.d.ts +1 -0
- package/src/command-line/release/command-object.js +31 -12
- package/src/command-line/release/publish.js +8 -11
- package/src/command-line/release/release.js +57 -6
- package/src/command-line/release/utils/git.d.ts +5 -1
- package/src/command-line/release/utils/git.js +26 -11
- package/src/command-line/release/utils/github.d.ts +4 -8
- package/src/command-line/release/utils/github.js +102 -34
- package/src/command-line/release/utils/shared.d.ts +1 -0
- package/src/command-line/release/utils/shared.js +3 -1
- package/src/command-line/release/version.js +0 -6
- package/src/core/graph/3rdpartylicenses.txt +0 -51
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/polyfills.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/executors/run-commands/run-commands.impl.js +3 -3
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/plugins/js/utils/register.d.ts +4 -8
- package/src/plugins/js/utils/register.js +8 -22
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +2 -3
- package/src/plugins/target-defaults/target-defaults-plugin.js +24 -32
- package/src/project-graph/utils/project-configuration-utils.js +13 -6
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +20 -23
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +16 -16
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +1 -1
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +10 -2
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
- package/src/tasks-runner/task-orchestrator.js +23 -1
- package/src/utils/json.js +3 -1
- package/src/utils/logger.js +1 -1
- package/src/utils/output.d.ts +0 -1
- package/src/utils/output.js +6 -7
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +12 -11
- package/src/utils/plugins/core-plugins.js +4 -0
|
@@ -7,7 +7,7 @@ const output_1 = require("../../utils/output");
|
|
|
7
7
|
const VIEW_LOGS_MESSAGE = `Hint: Try "nx view-logs" to get structured, searchable errors logs in your browser.`;
|
|
8
8
|
function viewLogsFooterRows(failedTasks) {
|
|
9
9
|
if (failedTasks >= 2 && !(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
|
10
|
-
return [``, output_1.output.dim(
|
|
10
|
+
return [``, output_1.output.dim(` ${VIEW_LOGS_MESSAGE}`)];
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
return [];
|
|
@@ -9,6 +9,7 @@ const utils_1 = require("./utils");
|
|
|
9
9
|
const tasks_schedule_1 = require("./tasks-schedule");
|
|
10
10
|
const hash_task_1 = require("../hasher/hash-task");
|
|
11
11
|
const task_env_1 = require("./task-env");
|
|
12
|
+
const os = require("os");
|
|
12
13
|
class TaskOrchestrator {
|
|
13
14
|
// endregion internal state
|
|
14
15
|
constructor(hasher, initiatingProject, projectGraph, taskGraph, options, bail, daemon) {
|
|
@@ -216,8 +217,10 @@ class TaskOrchestrator {
|
|
|
216
217
|
}
|
|
217
218
|
async runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput) {
|
|
218
219
|
try {
|
|
220
|
+
let usePtyFork = process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
|
|
221
|
+
supportedPtyPlatform();
|
|
219
222
|
// execution
|
|
220
|
-
const { code, terminalOutput } =
|
|
223
|
+
const { code, terminalOutput } = usePtyFork
|
|
221
224
|
? await this.forkedProcessTaskRunner.forkProcess(task, {
|
|
222
225
|
temporaryOutputPath,
|
|
223
226
|
streamOutput,
|
|
@@ -373,3 +376,22 @@ class TaskOrchestrator {
|
|
|
373
376
|
}
|
|
374
377
|
}
|
|
375
378
|
exports.TaskOrchestrator = TaskOrchestrator;
|
|
379
|
+
function supportedPtyPlatform() {
|
|
380
|
+
if (process.platform !== 'win32') {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
let windowsVersion = os.release().split('.');
|
|
384
|
+
let windowsBuild = windowsVersion[2];
|
|
385
|
+
if (!windowsBuild) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
// Mininum supported Windows version:
|
|
389
|
+
// https://en.wikipedia.org/wiki/Windows_10,_version_1809
|
|
390
|
+
// https://learn.microsoft.com/en-us/windows/console/createpseudoconsole#requirements
|
|
391
|
+
if (+windowsBuild < 17763) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
}
|
package/src/utils/json.js
CHANGED
|
@@ -15,7 +15,9 @@ const code_frames_1 = require("./code-frames");
|
|
|
15
15
|
*/
|
|
16
16
|
function parseJson(input, options) {
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
if (options?.expectComments !== true) {
|
|
19
|
+
return JSON.parse(input);
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
22
|
catch { }
|
|
21
23
|
options = { allowTrailingComma: true, ...options };
|
package/src/utils/logger.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stripIndent = exports.logger = exports.NX_ERROR = exports.NX_PREFIX = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
|
-
exports.NX_PREFIX =
|
|
5
|
+
exports.NX_PREFIX = chalk.inverse(chalk.bold(chalk.cyan(' NX ')));
|
|
6
6
|
exports.NX_ERROR = chalk.inverse(chalk.bold(chalk.red(' ERROR ')));
|
|
7
7
|
exports.logger = {
|
|
8
8
|
warn: (s) => console.warn(chalk.bold(chalk.yellow(s))),
|
package/src/utils/output.d.ts
CHANGED
package/src/utils/output.js
CHANGED
|
@@ -16,7 +16,6 @@ if ((0, is_ci_1.isCI)() && !forceColor) {
|
|
|
16
16
|
}
|
|
17
17
|
class CLIOutput {
|
|
18
18
|
constructor() {
|
|
19
|
-
this.X_PADDING = ' ';
|
|
20
19
|
this.cliName = 'NX';
|
|
21
20
|
this.formatCommand = (taskId) => `${chalk.dim('nx run')} ${taskId}`;
|
|
22
21
|
/**
|
|
@@ -41,7 +40,7 @@ class CLIOutput {
|
|
|
41
40
|
*/
|
|
42
41
|
get VERTICAL_SEPARATOR() {
|
|
43
42
|
let divider = '';
|
|
44
|
-
for (let i = 0; i < process.stdout.columns -
|
|
43
|
+
for (let i = 0; i < process.stdout.columns - 1; i++) {
|
|
45
44
|
divider += '\u2014';
|
|
46
45
|
}
|
|
47
46
|
return divider;
|
|
@@ -58,22 +57,22 @@ class CLIOutput {
|
|
|
58
57
|
process.stdout.write(os_1.EOL);
|
|
59
58
|
}
|
|
60
59
|
writeOutputTitle({ color, title, }) {
|
|
61
|
-
this.writeToStdOut(
|
|
60
|
+
this.writeToStdOut(`${this.applyNxPrefix(color, title)}${os_1.EOL}`);
|
|
62
61
|
}
|
|
63
62
|
writeOptionalOutputBody(bodyLines) {
|
|
64
63
|
if (!bodyLines) {
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
66
|
this.addNewline();
|
|
68
|
-
bodyLines.forEach((bodyLine) => this.writeToStdOut(
|
|
67
|
+
bodyLines.forEach((bodyLine) => this.writeToStdOut(`${bodyLine}${os_1.EOL}`));
|
|
69
68
|
}
|
|
70
69
|
applyNxPrefix(color = 'cyan', text) {
|
|
71
70
|
let nxPrefix = '';
|
|
72
71
|
if (chalk[color]) {
|
|
73
|
-
nxPrefix =
|
|
72
|
+
nxPrefix = chalk.reset.inverse.bold[color](` ${this.cliName} `);
|
|
74
73
|
}
|
|
75
74
|
else {
|
|
76
|
-
nxPrefix =
|
|
75
|
+
nxPrefix = chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `);
|
|
77
76
|
}
|
|
78
77
|
return `${nxPrefix} ${text}`;
|
|
79
78
|
}
|
|
@@ -92,7 +91,7 @@ class CLIOutput {
|
|
|
92
91
|
return ['', this.getVerticalSeparator(color), ''];
|
|
93
92
|
}
|
|
94
93
|
getVerticalSeparator(color) {
|
|
95
|
-
return
|
|
94
|
+
return chalk.dim[color](this.VERTICAL_SEPARATOR);
|
|
96
95
|
}
|
|
97
96
|
error({ title, slug, bodyLines }) {
|
|
98
97
|
this.addNewline();
|
|
@@ -64,7 +64,7 @@ export declare function normalizePackageGroup(packageGroup: PackageGroup): Array
|
|
|
64
64
|
export declare function readNxMigrateConfig(json: Partial<PackageJson>): NxMigrationsConfiguration & {
|
|
65
65
|
packageGroup?: ArrayPackageGroup;
|
|
66
66
|
};
|
|
67
|
-
export declare function buildTargetFromScript(script: string
|
|
67
|
+
export declare function buildTargetFromScript(script: string): TargetConfiguration;
|
|
68
68
|
export declare function readTargetsFromPackageJson(packageJson: PackageJson): Record<string, TargetConfiguration<any>>;
|
|
69
69
|
/**
|
|
70
70
|
* Uses `require.resolve` to read the package.json for a module.
|
|
@@ -5,6 +5,7 @@ const fs_1 = require("fs");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const fileutils_1 = require("./fileutils");
|
|
7
7
|
const installation_directory_1 = require("./installation-directory");
|
|
8
|
+
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
|
8
9
|
function normalizePackageGroup(packageGroup) {
|
|
9
10
|
return Array.isArray(packageGroup)
|
|
10
11
|
? packageGroup.map((x) => typeof x === 'string' ? { package: x, version: '*' } : x)
|
|
@@ -37,32 +38,32 @@ function readNxMigrateConfig(json) {
|
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
exports.readNxMigrateConfig = readNxMigrateConfig;
|
|
40
|
-
function buildTargetFromScript(script
|
|
41
|
-
const nxTargetConfiguration = nx?.targets?.[script] || {};
|
|
41
|
+
function buildTargetFromScript(script) {
|
|
42
42
|
return {
|
|
43
|
-
...nxTargetConfiguration,
|
|
44
43
|
executor: 'nx:run-script',
|
|
45
44
|
options: {
|
|
46
|
-
...(nxTargetConfiguration.options || {}),
|
|
47
45
|
script,
|
|
48
46
|
},
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
49
|
exports.buildTargetFromScript = buildTargetFromScript;
|
|
52
50
|
function readTargetsFromPackageJson(packageJson) {
|
|
53
|
-
const { scripts, nx } = packageJson;
|
|
51
|
+
const { scripts, nx, private: isPrivate } = packageJson ?? {};
|
|
54
52
|
const res = {};
|
|
55
|
-
Object.keys(scripts
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
53
|
+
const includedScripts = nx?.includedScripts || Object.keys(scripts ?? {});
|
|
54
|
+
//
|
|
55
|
+
for (const script of includedScripts) {
|
|
56
|
+
res[script] = buildTargetFromScript(script);
|
|
57
|
+
}
|
|
58
|
+
for (const targetName in nx?.targets) {
|
|
59
|
+
res[targetName] = (0, project_configuration_utils_1.mergeTargetConfigurations)(nx?.targets[targetName], res[targetName]);
|
|
60
|
+
}
|
|
60
61
|
/**
|
|
61
62
|
* Add implicit nx-release-publish target for all package.json files that are
|
|
62
63
|
* not marked as `"private": true` to allow for lightweight configuration for
|
|
63
64
|
* package based repos.
|
|
64
65
|
*/
|
|
65
|
-
if (!
|
|
66
|
+
if (!isPrivate && !res['nx-release-publish']) {
|
|
66
67
|
res['nx-release-publish'] = {
|
|
67
68
|
dependsOn: ['^nx-release-publish'],
|
|
68
69
|
executor: '@nx/js:release-publish',
|