nx 20.0.0-beta.7 → 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 (51) 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/src/adapter/compat.d.ts +1 -1
  6. package/src/adapter/compat.js +1 -1
  7. package/src/command-line/affected/affected.js +0 -2
  8. package/src/command-line/release/utils/git.js +2 -2
  9. package/src/command-line/run/run-one.js +0 -2
  10. package/src/command-line/run/run.js +0 -1
  11. package/src/command-line/run-many/run-many.js +1 -4
  12. package/src/config/misc-interfaces.d.ts +3 -15
  13. package/src/config/nx-json.d.ts +2 -2
  14. package/src/config/project-graph.d.ts +0 -2
  15. package/src/core/graph/main.js +1 -1
  16. package/src/daemon/client/client.js +1 -3
  17. package/src/devkit-exports.d.ts +3 -4
  18. package/src/devkit-exports.js +3 -6
  19. package/src/executors/utils/convert-nx-executor.js +0 -1
  20. package/src/generators/utils/nx-json.d.ts +1 -1
  21. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  22. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  23. package/src/native/nx.wasm32-wasi.wasm +0 -0
  24. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
  25. package/src/project-graph/build-project-graph.js +3 -41
  26. package/src/project-graph/error-types.d.ts +4 -10
  27. package/src/project-graph/error-types.js +1 -12
  28. package/src/project-graph/file-utils.js +1 -1
  29. package/src/project-graph/nx-deps-cache.d.ts +0 -1
  30. package/src/project-graph/nx-deps-cache.js +0 -1
  31. package/src/project-graph/plugins/internal-api.d.ts +2 -5
  32. package/src/project-graph/plugins/internal-api.js +0 -1
  33. package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
  34. package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
  35. package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
  36. package/src/project-graph/plugins/loader.js +2 -3
  37. package/src/project-graph/plugins/public-api.d.ts +6 -7
  38. package/src/project-graph/plugins/utils.d.ts +1 -7
  39. package/src/project-graph/plugins/utils.js +0 -37
  40. package/src/project-graph/utils/project-configuration-utils.js +1 -1
  41. package/src/tasks-runner/batch/run-batch.js +0 -1
  42. package/src/tasks-runner/cache.js +2 -1
  43. package/src/tasks-runner/init-tasks-runner.js +0 -2
  44. package/src/utils/command-line-utils.js +24 -33
  45. package/src/utils/plugins/plugin-capabilities.js +2 -3
  46. package/src/utils/app-root.d.ts +0 -8
  47. package/src/utils/app-root.js +0 -12
  48. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  49. package/src/utils/nx-plugin.deprecated.js +0 -20
  50. package/src/utils/workspace-configuration-check.d.ts +0 -1
  51. package/src/utils/workspace-configuration-check.js +0 -36
@@ -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';
@@ -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
- }