nx 20.0.0-beta.6 → 20.0.0-beta.8

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.
Files changed (64) hide show
  1. package/bin/init-local.js +0 -39
  2. package/bin/nx.js +3 -13
  3. package/migrations.json +5 -0
  4. package/package.json +11 -11
  5. package/release/changelog-renderer/index.d.ts +60 -38
  6. package/release/changelog-renderer/index.js +260 -236
  7. package/src/adapter/compat.d.ts +1 -1
  8. package/src/adapter/compat.js +1 -1
  9. package/src/command-line/add/add.js +2 -2
  10. package/src/command-line/affected/affected.js +0 -2
  11. package/src/command-line/nx-commands.js +31 -10
  12. package/src/command-line/release/changelog.d.ts +2 -2
  13. package/src/command-line/release/changelog.js +28 -29
  14. package/src/command-line/release/utils/git.js +2 -2
  15. package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
  16. package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
  17. package/src/command-line/run/run-one.js +0 -2
  18. package/src/command-line/run/run.js +0 -1
  19. package/src/command-line/run-many/run-many.js +1 -4
  20. package/src/command-line/yargs-utils/shared-options.js +2 -2
  21. package/src/config/misc-interfaces.d.ts +3 -15
  22. package/src/config/nx-json.d.ts +4 -3
  23. package/src/config/project-graph.d.ts +0 -2
  24. package/src/core/graph/main.js +1 -1
  25. package/src/daemon/client/client.js +1 -3
  26. package/src/devkit-exports.d.ts +3 -4
  27. package/src/devkit-exports.js +3 -6
  28. package/src/executors/utils/convert-nx-executor.js +0 -1
  29. package/src/generators/utils/nx-json.d.ts +1 -1
  30. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  31. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  32. package/src/native/nx.wasm32-wasi.wasm +0 -0
  33. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
  34. package/src/project-graph/build-project-graph.js +3 -41
  35. package/src/project-graph/error-types.d.ts +4 -10
  36. package/src/project-graph/error-types.js +1 -12
  37. package/src/project-graph/file-utils.js +1 -1
  38. package/src/project-graph/nx-deps-cache.d.ts +0 -1
  39. package/src/project-graph/nx-deps-cache.js +0 -1
  40. package/src/project-graph/plugins/internal-api.d.ts +2 -5
  41. package/src/project-graph/plugins/internal-api.js +0 -1
  42. package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
  43. package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
  44. package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
  45. package/src/project-graph/plugins/loader.js +2 -3
  46. package/src/project-graph/plugins/public-api.d.ts +6 -7
  47. package/src/project-graph/plugins/utils.d.ts +1 -7
  48. package/src/project-graph/plugins/utils.js +0 -37
  49. package/src/project-graph/utils/project-configuration-utils.js +1 -1
  50. package/src/tasks-runner/batch/run-batch.js +0 -1
  51. package/src/tasks-runner/cache.d.ts +2 -0
  52. package/src/tasks-runner/cache.js +7 -2
  53. package/src/tasks-runner/create-task-graph.js +4 -4
  54. package/src/tasks-runner/init-tasks-runner.js +0 -2
  55. package/src/tasks-runner/run-command.js +15 -2
  56. package/src/utils/command-line-utils.d.ts +3 -0
  57. package/src/utils/command-line-utils.js +24 -33
  58. package/src/utils/plugins/plugin-capabilities.js +2 -3
  59. package/src/utils/app-root.d.ts +0 -8
  60. package/src/utils/app-root.js +0 -12
  61. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  62. package/src/utils/nx-plugin.deprecated.js +0 -20
  63. package/src/utils/workspace-configuration-check.d.ts +0 -1
  64. package/src/utils/workspace-configuration-check.js +0 -36
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cache = exports.DbCache = void 0;
4
+ exports.dbCacheEnabled = dbCacheEnabled;
4
5
  exports.getCache = getCache;
5
6
  const workspace_root_1 = require("../utils/workspace-root");
6
7
  const path_1 = require("path");
@@ -19,11 +20,15 @@ const update_manager_1 = require("../nx-cloud/update-manager");
19
20
  const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
20
21
  const is_ci_1 = require("../utils/is-ci");
21
22
  const output_1 = require("../utils/output");
23
+ function dbCacheEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
24
+ return (process.env.NX_DISABLE_DB !== 'true' &&
25
+ nxJson.useLegacyCache !== true &&
26
+ process.env.NX_DB_CACHE !== 'false');
27
+ }
22
28
  // Do not change the order of these arguments as this function is used by nx cloud
23
29
  function getCache(options) {
24
30
  const nxJson = (0, nx_json_1.readNxJson)();
25
- return process.env.NX_DISABLE_DB !== 'true' &&
26
- (nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true')
31
+ return dbCacheEnabled(nxJson)
27
32
  ? new DbCache({
28
33
  // Remove this in Nx 21
29
34
  nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
@@ -54,10 +54,10 @@ class ProcessTasks {
54
54
  }
55
55
  }
56
56
  this.filterDummyTasks();
57
- for (const projectName of Object.keys(this.dependencies)) {
58
- if (this.dependencies[projectName].length > 1) {
59
- this.dependencies[projectName] = [
60
- ...new Set(this.dependencies[projectName]).values(),
57
+ for (const taskId of Object.keys(this.dependencies)) {
58
+ if (this.dependencies[taskId].length > 0) {
59
+ this.dependencies[taskId] = [
60
+ ...new Set(this.dependencies[taskId].filter((d) => d !== taskId)).values(),
61
61
  ];
62
62
  }
63
63
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initTasksRunner = initTasksRunner;
4
- const workspace_configuration_check_1 = require("../utils/workspace-configuration-check");
5
4
  const configuration_1 = require("../config/configuration");
6
5
  const project_graph_1 = require("../project-graph/project-graph");
7
6
  const run_command_1 = require("./run-command");
@@ -12,7 +11,6 @@ const dotenv_1 = require("../utils/dotenv");
12
11
  async function initTasksRunner(nxArgs) {
13
12
  perf_hooks_1.performance.mark('init-local');
14
13
  (0, dotenv_1.loadRootEnvFiles)();
15
- (0, workspace_configuration_check_1.workspaceConfigurationCheck)();
16
14
  const nxJson = (0, configuration_1.readNxJson)();
17
15
  if (nxArgs.verbose) {
18
16
  process.env.NX_VERBOSE_LOGGING = 'true';
@@ -511,12 +511,21 @@ function loadTasksRunner(modulePath) {
511
511
  }
512
512
  function getRunner(nxArgs, nxJson) {
513
513
  let runner = nxArgs.runner;
514
- runner = runner || 'default';
514
+ runner = runner ?? 'default';
515
515
  if (runner !== 'default' && !nxJson.tasksRunnerOptions?.[runner]) {
516
516
  throw new Error(`Could not find runner configuration for ${runner}`);
517
517
  }
518
518
  const modulePath = getTasksRunnerPath(runner, nxJson);
519
519
  try {
520
+ if (isCustomRunnerPath(modulePath)) {
521
+ output_1.output.warn({
522
+ title: `Custom task runners will no longer be supported in Nx 21.`,
523
+ bodyLines: [
524
+ `Use Nx Cloud or the Nx Powerpack caches instead.`,
525
+ `For more information, see https://nx.dev/features/powerpack/custom-caching`,
526
+ ],
527
+ });
528
+ }
520
529
  const tasksRunner = loadTasksRunner(modulePath);
521
530
  return {
522
531
  tasksRunner,
@@ -527,6 +536,7 @@ function getRunner(nxArgs, nxJson) {
527
536
  throw new Error(`Could not find runner configuration for ${runner}`);
528
537
  }
529
538
  }
539
+ const defaultTasksRunnerPath = require.resolve('./default-tasks-runner');
530
540
  function getTasksRunnerPath(runner, nxJson) {
531
541
  let modulePath = nxJson.tasksRunnerOptions?.[runner]?.runner;
532
542
  if (modulePath) {
@@ -544,7 +554,7 @@ function getTasksRunnerPath(runner, nxJson) {
544
554
  process.env.NX_CLOUD_ACCESS_TOKEN ||
545
555
  // Nx Cloud ID specified in nxJson
546
556
  nxJson.nxCloudId;
547
- return isCloudRunner ? 'nx-cloud' : require.resolve('./default-tasks-runner');
557
+ return isCloudRunner ? 'nx-cloud' : defaultTasksRunnerPath;
548
558
  }
549
559
  function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
550
560
  const defaultCacheableOperations = [];
@@ -588,3 +598,6 @@ function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
588
598
  }
589
599
  return result;
590
600
  }
601
+ function isCustomRunnerPath(modulePath) {
602
+ return !['nx-cloud', '@nrwl/nx-cloud', defaultTasksRunnerPath].includes(modulePath);
603
+ }
@@ -7,6 +7,9 @@ export interface RawNxArgs extends NxArgs {
7
7
  export interface NxArgs {
8
8
  targets?: string[];
9
9
  configuration?: string;
10
+ /**
11
+ * @deprecated Custom task runners will no longer be supported in Nx 21. Use Nx Cloud or Nx Powerpack instead.
12
+ */
10
13
  runner?: string;
11
14
  parallel?: number;
12
15
  untracked?: boolean;
@@ -139,41 +139,32 @@ function readParallelFromArgsAndEnv(args) {
139
139
  }
140
140
  function normalizeNxArgsRunner(nxArgs, nxJson, options) {
141
141
  if (!nxArgs.runner) {
142
- // TODO: Remove NX_RUNNER environment variable support in Nx v17
143
- for (const envKey of ['NX_TASKS_RUNNER', 'NX_RUNNER']) {
144
- const runner = process.env[envKey];
145
- if (runner) {
146
- const runnerExists = nxJson.tasksRunnerOptions?.[runner];
147
- if (options.printWarnings) {
148
- if (runnerExists) {
149
- output_1.output.note({
150
- title: `No explicit --runner argument provided, but found environment variable ${envKey} so using its value: ${output_1.output.bold(`${runner}`)}`,
151
- });
152
- }
153
- else if (nxArgs.verbose ||
154
- process.env.NX_VERBOSE_LOGGING === 'true') {
155
- output_1.output.warn({
156
- title: `Could not find ${output_1.output.bold(`${runner}`)} within \`nx.json\` tasksRunnerOptions.`,
157
- bodyLines: [
158
- `${output_1.output.bold(`${runner}`)} was set by ${envKey}`,
159
- ``,
160
- `To suppress this message, either:`,
161
- ` - provide a valid task runner with --runner`,
162
- ` - ensure NX_TASKS_RUNNER matches a task runner defined in nx.json`,
163
- ],
164
- });
165
- }
166
- }
142
+ const envKey = 'NX_TASKS_RUNNER';
143
+ const runner = process.env[envKey];
144
+ if (runner) {
145
+ const runnerExists = nxJson.tasksRunnerOptions?.[runner];
146
+ if (options.printWarnings) {
167
147
  if (runnerExists) {
168
- // TODO: Remove in v17
169
- if (envKey === 'NX_RUNNER' && options.printWarnings) {
170
- output_1.output.warn({
171
- title: 'NX_RUNNER is deprecated, please use NX_TASKS_RUNNER instead.',
172
- });
173
- }
174
- nxArgs.runner = runner;
148
+ output_1.output.note({
149
+ title: `No explicit --runner argument provided, but found environment variable ${envKey} so using its value: ${output_1.output.bold(`${runner}`)}`,
150
+ });
175
151
  }
176
- break;
152
+ else if (nxArgs.verbose ||
153
+ process.env.NX_VERBOSE_LOGGING === 'true') {
154
+ output_1.output.warn({
155
+ title: `Could not find ${output_1.output.bold(`${runner}`)} within \`nx.json\` tasksRunnerOptions.`,
156
+ bodyLines: [
157
+ `${output_1.output.bold(`${runner}`)} was set by ${envKey}`,
158
+ ``,
159
+ `To suppress this message, either:`,
160
+ ` - provide a valid task runner with --runner`,
161
+ ` - ensure NX_TASKS_RUNNER matches a task runner defined in nx.json`,
162
+ ],
163
+ });
164
+ }
165
+ }
166
+ if (runnerExists) {
167
+ nxArgs.runner = runner;
177
168
  }
178
169
  }
179
170
  }
@@ -20,7 +20,7 @@ function tryGetCollection(packageJsonPath, collectionFile, propName) {
20
20
  }
21
21
  async function getPluginCapabilities(workspaceRoot, pluginName, projects, includeRuntimeCapabilities = false) {
22
22
  try {
23
- const { json: packageJson, path: packageJsonPath } = await (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
23
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
24
24
  const pluginModule = includeRuntimeCapabilities
25
25
  ? await tryGetModule(packageJson, workspaceRoot)
26
26
  : {};
@@ -62,8 +62,7 @@ async function tryGetModule(packageJson, workspaceRoot) {
62
62
  packageJson['schematics'] ??
63
63
  packageJson['builders']) {
64
64
  const [pluginPromise] = (0, loader_1.loadNxPlugin)(packageJson.name, workspaceRoot);
65
- const plugin = await pluginPromise;
66
- return plugin;
65
+ return await pluginPromise;
67
66
  }
68
67
  else {
69
68
  return {
@@ -1,8 +0,0 @@
1
- import { workspaceRoot } from './workspace-root';
2
- /**
3
- * The root of the workspace.
4
- *
5
- * @deprecated use workspaceRoot instead
6
- */
7
- export declare const appRootPath: string;
8
- export { workspaceRoot };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.workspaceRoot = exports.appRootPath = void 0;
4
- // TODO(v16): Remove this file
5
- const workspace_root_1 = require("./workspace-root");
6
- Object.defineProperty(exports, "workspaceRoot", { enumerable: true, get: function () { return workspace_root_1.workspaceRoot; } });
7
- /**
8
- * The root of the workspace.
9
- *
10
- * @deprecated use workspaceRoot instead
11
- */
12
- exports.appRootPath = workspace_root_1.workspaceRoot;
@@ -1,31 +0,0 @@
1
- import { ProjectGraphProcessor } from '../config/project-graph';
2
- import { TargetConfiguration } from '../config/workspace-json-project-json';
3
- import { NxPluginV2 } from '../project-graph/plugins';
4
- /**
5
- * @deprecated Add targets to the projects in a {@link CreateNodes} function instead. This will be removed in Nx 20
6
- */
7
- export type ProjectTargetConfigurator = (file: string) => Record<string, TargetConfiguration>;
8
- /**
9
- * @deprecated Use {@link NxPluginV2} instead. This will be removed in Nx 20
10
- */
11
- export type NxPluginV1 = {
12
- name: string;
13
- /**
14
- * @deprecated Use {@link CreateNodes} and {@link CreateDependencies} instead. This will be removed in Nx 20
15
- */
16
- processProjectGraph?: ProjectGraphProcessor;
17
- /**
18
- * @deprecated Add targets to the projects inside of {@link CreateNodes} instead. This will be removed in Nx 20
19
- */
20
- registerProjectTargets?: ProjectTargetConfigurator;
21
- /**
22
- * A glob pattern to search for non-standard project files.
23
- * @example: ["*.csproj", "pom.xml"]
24
- * @deprecated Use {@link CreateNodes} instead. This will be removed in Nx 20
25
- */
26
- projectFilePatterns?: string[];
27
- };
28
- /**
29
- * @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
30
- */
31
- export declare function getDefaultPluginsSync(root: string): NxPluginV2[];
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultPluginsSync = getDefaultPluginsSync;
4
- const angular_json_1 = require("../adapter/angular-json");
5
- const project_json_1 = require("../plugins/project-json/build-nodes/project-json");
6
- const PackageJsonWorkspacesPlugin = require("../plugins/package-json");
7
- /**
8
- * @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
9
- */
10
- function getDefaultPluginsSync(root) {
11
- const plugins = [
12
- require('../plugins/js'),
13
- ...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
14
- ? [require('../adapter/angular-json').NxAngularJsonPlugin]
15
- : []),
16
- PackageJsonWorkspacesPlugin,
17
- project_json_1.default,
18
- ];
19
- return plugins;
20
- }
@@ -1 +0,0 @@
1
- export declare function workspaceConfigurationCheck(): void;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.workspaceConfigurationCheck = workspaceConfigurationCheck;
4
- const workspace_root_1 = require("./workspace-root");
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
7
- const output_1 = require("./output");
8
- const fileutils_1 = require("../utils/fileutils");
9
- //TODO: vsavkin remove after Nx 19
10
- function workspaceConfigurationCheck() {
11
- if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'workspace.json'))) {
12
- output_1.output.warn({
13
- title: 'workspace.json is ignored',
14
- bodyLines: [
15
- 'Nx no longer reads configuration from workspace.json.',
16
- 'Run "nx g @nx/workspace:fix-configuration" to split workspace.json into individual project.json files.',
17
- ],
18
- });
19
- return;
20
- }
21
- if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'angular.json'))) {
22
- const angularJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(workspace_root_1.workspaceRoot, 'angular.json'));
23
- const v2Props = Object.values(angularJson.projects).find((p) => !!p.targets);
24
- if (angularJson.version === 2 || v2Props) {
25
- output_1.output.error({
26
- title: 'angular.json format is incorrect',
27
- bodyLines: [
28
- 'Nx no longer supports the v2 format of angular.json.',
29
- 'Run "nx g @nx/workspace:fix-configuration" to split angular.json into individual project.json files. (Recommended)',
30
- 'If you want to preserve angular.json, run "nx g @nx/workspace:fix-configuration --reformat"',
31
- ],
32
- });
33
- process.exit(1);
34
- }
35
- }
36
- }