nx 18.1.0-canary.20240222-5d6abe4 → 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 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.20240222-5d6abe4",
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.20240222-5d6abe4"
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.20240222-5d6abe4",
85
- "@nx/nx-darwin-arm64": "18.1.0-canary.20240222-5d6abe4",
86
- "@nx/nx-linux-x64-gnu": "18.1.0-canary.20240222-5d6abe4",
87
- "@nx/nx-linux-x64-musl": "18.1.0-canary.20240222-5d6abe4",
88
- "@nx/nx-win32-x64-msvc": "18.1.0-canary.20240222-5d6abe4",
89
- "@nx/nx-linux-arm64-gnu": "18.1.0-canary.20240222-5d6abe4",
90
- "@nx/nx-linux-arm64-musl": "18.1.0-canary.20240222-5d6abe4",
91
- "@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.20240222-5d6abe4",
92
- "@nx/nx-win32-arm64-msvc": "18.1.0-canary.20240222-5d6abe4",
93
- "@nx/nx-freebsd-x64": "18.1.0-canary.20240222-5d6abe4"
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",
@@ -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",
@@ -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"];
@@ -38,6 +38,7 @@ exports.allowedProjectExtensions = [
38
38
  exports.allowedWorkspaceExtensions = [
39
39
  'implicitDependencies',
40
40
  'affected',
41
+ 'defaultBase',
41
42
  'tasksRunnerOptions',
42
43
  'workspaceLayout',
43
44
  'plugins',
@@ -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.affected ??= {};
45
- nxJson.affected.defaultBase ??= deduceDefaultBase();
44
+ nxJson.defaultBase ??= deduceDefaultBase();
46
45
  (0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
47
46
  }
48
47
  exports.createNxJsonFile = createNxJsonFile;
@@ -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 logger_1 = require("../../utils/logger");
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
- logger_1.logger.warn({
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
- logger_1.logger.warn({
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,5 @@
1
+ import { Tree } from '../../generators/tree';
2
+ /**
3
+ * Updates existing workspaces to move nx.json's affected.defaultBase to nx.json's base.
4
+ */
5
+ export default function update(host: Tree): void;
@@ -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;
@@ -84,7 +84,8 @@ function splitArgsIntoNxArgsAndOverrides(args, mode, options = { printWarnings:
84
84
  }
85
85
  }
86
86
  if (!nxArgs.base) {
87
- nxArgs.base = nxJson.affected?.defaultBase || 'main';
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
- return JSON.parse(input);
18
+ if (options?.expectComments !== true) {
19
+ return JSON.parse(input);
20
+ }
19
21
  }
20
22
  catch { }
21
23
  options = { allowTrailingComma: true, ...options };