nx 18.1.0-canary.20240221-abc0cf8 → 18.1.0-canary.20240223-21e7648
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/migrations.json +5 -0
- package/package.json +13 -12
- package/schemas/nx-schema.json +6 -1
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/graph/graph.js +1 -1
- package/src/command-line/init/implementation/utils.js +1 -2
- package/src/command-line/release/changelog.js +37 -0
- package/src/config/nx-json.d.ts +8 -0
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/src/migrations/update-17-2-0/move-default-base.js +19 -0
- package/src/tasks-runner/task-orchestrator.js +23 -1
- package/src/utils/command-line-utils.js +2 -1
- package/src/utils/json.js +3 -1
- package/src/utils/plugins/core-plugins.js +4 -0
package/migrations.json
CHANGED
@@ -89,6 +89,11 @@
|
|
89
89
|
"description": "Updates .env to disabled adding plugins when generating projects in an existing Nx workspace",
|
90
90
|
"implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
|
91
91
|
"x-repair-skip": true
|
92
|
+
},
|
93
|
+
"move-default-base-to-nx-json-root": {
|
94
|
+
"version": "18.1.0-beta.3",
|
95
|
+
"description": "Moves affected.defaultBase to defaultBase in `nx.json`",
|
96
|
+
"implementation": "./src/migrations/update-17-2-0/move-default-base"
|
92
97
|
}
|
93
98
|
}
|
94
99
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "18.1.0-canary.
|
3
|
+
"version": "18.1.0-canary.20240223-21e7648",
|
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.1.0-canary.
|
69
|
+
"@nrwl/tao": "18.1.0-canary.20240223-21e7648"
|
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.1.0-canary.
|
85
|
-
"@nx/nx-darwin-arm64": "18.1.0-canary.
|
86
|
-
"@nx/nx-linux-x64-gnu": "18.1.0-canary.
|
87
|
-
"@nx/nx-linux-x64-musl": "18.1.0-canary.
|
88
|
-
"@nx/nx-win32-x64-msvc": "18.1.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "18.1.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "18.1.0-canary.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "18.1.0-canary.
|
93
|
-
"@nx/nx-freebsd-x64": "18.1.0-canary.
|
84
|
+
"@nx/nx-darwin-x64": "18.1.0-canary.20240223-21e7648",
|
85
|
+
"@nx/nx-darwin-arm64": "18.1.0-canary.20240223-21e7648",
|
86
|
+
"@nx/nx-linux-x64-gnu": "18.1.0-canary.20240223-21e7648",
|
87
|
+
"@nx/nx-linux-x64-musl": "18.1.0-canary.20240223-21e7648",
|
88
|
+
"@nx/nx-win32-x64-msvc": "18.1.0-canary.20240223-21e7648",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "18.1.0-canary.20240223-21e7648",
|
90
|
+
"@nx/nx-linux-arm64-musl": "18.1.0-canary.20240223-21e7648",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.20240223-21e7648",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "18.1.0-canary.20240223-21e7648",
|
93
|
+
"@nx/nx-freebsd-x64": "18.1.0-canary.20240223-21e7648"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
@@ -126,6 +126,7 @@
|
|
126
126
|
"@nrwl/next",
|
127
127
|
"@nx/node",
|
128
128
|
"@nrwl/node",
|
129
|
+
"@nx/nuxt",
|
129
130
|
"@nx/playwright",
|
130
131
|
"@nx/plugin",
|
131
132
|
"@nrwl/nx-plugin",
|
package/schemas/nx-schema.json
CHANGED
@@ -18,7 +18,12 @@
|
|
18
18
|
"description": "Default based branch used by affected commands."
|
19
19
|
}
|
20
20
|
},
|
21
|
-
"additionalProperties": false
|
21
|
+
"additionalProperties": false,
|
22
|
+
"deprecated": "Use `defaultBase` instead. Support for setting `defaultBase` in `affected` will be removed in Nx 19."
|
23
|
+
},
|
24
|
+
"defaultBase": {
|
25
|
+
"type": "string",
|
26
|
+
"description": "Default --base used by affected logic."
|
22
27
|
},
|
23
28
|
"tasksRunnerOptions": {
|
24
29
|
"type": "object",
|
package/src/adapter/compat.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts"];
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess"];
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess"];
|
package/src/adapter/compat.js
CHANGED
@@ -266,7 +266,7 @@ async function generateGraph(args, affectedProjects) {
|
|
266
266
|
const { app, url } = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude);
|
267
267
|
url.pathname = args.view;
|
268
268
|
if (args.focus) {
|
269
|
-
url.pathname += '/' + args.focus;
|
269
|
+
url.pathname += '/' + encodeURIComponent(args.focus);
|
270
270
|
}
|
271
271
|
if (target) {
|
272
272
|
url.pathname += '/' + target;
|
@@ -41,8 +41,7 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
|
|
41
41
|
if (Object.keys(nxJson.targetDefaults).length === 0) {
|
42
42
|
delete nxJson.targetDefaults;
|
43
43
|
}
|
44
|
-
nxJson.
|
45
|
-
nxJson.affected.defaultBase ??= deduceDefaultBase();
|
44
|
+
nxJson.defaultBase ??= deduceDefaultBase();
|
46
45
|
(0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
|
47
46
|
}
|
48
47
|
exports.createNxJsonFile = createNxJsonFile;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.shouldCreateGitHubRelease = exports.releaseChangelog = exports.releaseChangelogCLIHandler = void 0;
|
4
4
|
const chalk = require("chalk");
|
5
|
+
const enquirer_1 = require("enquirer");
|
5
6
|
const node_fs_1 = require("node:fs");
|
6
7
|
const semver_1 = require("semver");
|
7
8
|
const tmp_1 = require("tmp");
|
@@ -10,6 +11,7 @@ const tree_1 = require("../../generators/tree");
|
|
10
11
|
const register_1 = require("../../plugins/js/utils/register");
|
11
12
|
const project_graph_1 = require("../../project-graph/project-graph");
|
12
13
|
const utils_1 = require("../../tasks-runner/utils");
|
14
|
+
const is_ci_1 = require("../../utils/is-ci");
|
13
15
|
const output_1 = require("../../utils/output");
|
14
16
|
const params_1 = require("../../utils/params");
|
15
17
|
const path_1 = require("../../utils/path");
|
@@ -302,6 +304,25 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
302
304
|
`No changes were detected for any changelog files, so no changelog entries will be generated.`,
|
303
305
|
],
|
304
306
|
});
|
307
|
+
if (!postGitTasks.length) {
|
308
|
+
// no GitHub releases to create so we can just exit
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
if ((0, is_ci_1.isCI)()) {
|
312
|
+
output_1.output.warn({
|
313
|
+
title: `Skipped GitHub release creation because no changes were detected for any changelog files.`,
|
314
|
+
});
|
315
|
+
return;
|
316
|
+
}
|
317
|
+
// prompt the user to see if they want to create a GitHub release anyway
|
318
|
+
// we know that the user has configured GitHub releases because we have postGitTasks
|
319
|
+
const shouldCreateGitHubReleaseAnyway = await promptForGitHubRelease();
|
320
|
+
if (!shouldCreateGitHubReleaseAnyway) {
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
for (const postGitTask of postGitTasks) {
|
324
|
+
await postGitTask(latestCommit);
|
325
|
+
}
|
305
326
|
return;
|
306
327
|
}
|
307
328
|
// Generate a new commit for the changes, if configured to do so
|
@@ -600,3 +621,19 @@ function shouldCreateGitHubRelease(changelogConfig, createReleaseArg = undefined
|
|
600
621
|
return (changelogConfig || {}).createRelease === 'github';
|
601
622
|
}
|
602
623
|
exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
|
624
|
+
async function promptForGitHubRelease() {
|
625
|
+
try {
|
626
|
+
const result = await (0, enquirer_1.prompt)([
|
627
|
+
{
|
628
|
+
name: 'confirmation',
|
629
|
+
message: 'Do you want to create a GitHub release anyway?',
|
630
|
+
type: 'confirm',
|
631
|
+
},
|
632
|
+
]);
|
633
|
+
return result.confirmation;
|
634
|
+
}
|
635
|
+
catch (e) {
|
636
|
+
// Handle the case where the user exits the prompt with ctrl+c
|
637
|
+
return false;
|
638
|
+
}
|
639
|
+
}
|
package/src/config/nx-json.d.ts
CHANGED
@@ -7,6 +7,9 @@ export type ImplicitDependencyEntry<T = '*' | string[]> = {
|
|
7
7
|
export interface ImplicitJsonSubsetDependency<T = '*' | string[]> {
|
8
8
|
[key: string]: T | ImplicitJsonSubsetDependency<T>;
|
9
9
|
}
|
10
|
+
/**
|
11
|
+
* @deprecated Use {@link NxJsonConfiguration#defaultBase } instead
|
12
|
+
*/
|
10
13
|
export interface NxAffectedConfig {
|
11
14
|
/**
|
12
15
|
* Default based branch used by affected commands.
|
@@ -248,8 +251,13 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
248
251
|
targetDefaults?: TargetDefaults;
|
249
252
|
/**
|
250
253
|
* Default options for `nx affected`
|
254
|
+
* @deprecated use {@link defaultBase} instead. For more information see https://nx.dev/deprecated/affected-config#affected-config
|
251
255
|
*/
|
252
256
|
affected?: NxAffectedConfig;
|
257
|
+
/**
|
258
|
+
* Default value for --base used by `nx affected` and `nx format`.
|
259
|
+
*/
|
260
|
+
defaultBase?: string;
|
253
261
|
/**
|
254
262
|
* Where new apps + libs should be placed
|
255
263
|
*/
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
4
4
|
const nx_json_1 = require("../../generators/utils/nx-json");
|
5
5
|
const json_1 = require("../../generators/utils/json");
|
6
|
-
const
|
6
|
+
const output_1 = require("../../utils/output");
|
7
7
|
const path_1 = require("../../utils/path");
|
8
8
|
async function update(tree) {
|
9
9
|
if (!tree.exists('nx.json')) {
|
@@ -37,7 +37,7 @@ function warnNpmScopeHasChanged(tree, nxJson) {
|
|
37
37
|
}
|
38
38
|
const packageJsonName = (0, json_1.readJson)(tree, 'package.json').name;
|
39
39
|
if (newScope) {
|
40
|
-
|
40
|
+
output_1.output.warn({
|
41
41
|
title: 'npmScope has been removed from nx.json',
|
42
42
|
bodyLines: [
|
43
43
|
'This will now be read from package.json',
|
@@ -50,7 +50,7 @@ function warnNpmScopeHasChanged(tree, nxJson) {
|
|
50
50
|
}
|
51
51
|
else {
|
52
52
|
// There is no scope in package.json
|
53
|
-
|
53
|
+
output_1.output.warn({
|
54
54
|
title: 'npmScope has been removed from nx.json',
|
55
55
|
bodyLines: [
|
56
56
|
'This will now be read from package.json',
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
4
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
5
|
+
/**
|
6
|
+
* Updates existing workspaces to move nx.json's affected.defaultBase to nx.json's base.
|
7
|
+
*/
|
8
|
+
function update(host) {
|
9
|
+
const nxJson = (0, nx_json_1.readNxJson)(host);
|
10
|
+
if (nxJson?.affected?.defaultBase) {
|
11
|
+
nxJson.defaultBase = nxJson.affected.defaultBase;
|
12
|
+
delete nxJson.affected.defaultBase;
|
13
|
+
if (Object.keys(nxJson.affected).length === 0) {
|
14
|
+
delete nxJson.affected;
|
15
|
+
}
|
16
|
+
(0, nx_json_1.updateNxJson)(host, nxJson);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.default = update;
|
@@ -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
|
+
}
|
@@ -84,7 +84,8 @@ function splitArgsIntoNxArgsAndOverrides(args, mode, options = { printWarnings:
|
|
84
84
|
}
|
85
85
|
}
|
86
86
|
if (!nxArgs.base) {
|
87
|
-
nxArgs.base =
|
87
|
+
nxArgs.base =
|
88
|
+
nxJson.defaultBase ?? nxJson.affected?.defaultBase ?? 'main';
|
88
89
|
// No user-provided arguments to set the affected criteria, so inform the user of the defaults being used
|
89
90
|
if (options.printWarnings &&
|
90
91
|
!nxArgs.head &&
|
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 };
|