nx 19.6.0-canary.20240723-c4f9d89 → 19.6.0-canary.20240724-684d2a9

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.6.0-canary.20240723-c4f9d89",
3
+ "version": "19.6.0-canary.20240724-684d2a9",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.6.0-canary.20240723-c4f9d89"
74
+ "@nrwl/tao": "19.6.0-canary.20240724-684d2a9"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.6.0-canary.20240723-c4f9d89",
90
- "@nx/nx-darwin-arm64": "19.6.0-canary.20240723-c4f9d89",
91
- "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240723-c4f9d89",
92
- "@nx/nx-linux-x64-musl": "19.6.0-canary.20240723-c4f9d89",
93
- "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240723-c4f9d89",
94
- "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240723-c4f9d89",
95
- "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240723-c4f9d89",
96
- "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240723-c4f9d89",
97
- "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240723-c4f9d89",
98
- "@nx/nx-freebsd-x64": "19.6.0-canary.20240723-c4f9d89"
89
+ "@nx/nx-darwin-x64": "19.6.0-canary.20240724-684d2a9",
90
+ "@nx/nx-darwin-arm64": "19.6.0-canary.20240724-684d2a9",
91
+ "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240724-684d2a9",
92
+ "@nx/nx-linux-x64-musl": "19.6.0-canary.20240724-684d2a9",
93
+ "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240724-684d2a9",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240724-684d2a9",
95
+ "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240724-684d2a9",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240724-684d2a9",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240724-684d2a9",
98
+ "@nx/nx-freebsd-x64": "19.6.0-canary.20240724-684d2a9"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -117,7 +117,7 @@ async function watch(args) {
117
117
  if (args.verbose) {
118
118
  process.env.NX_VERBOSE_LOGGING = 'true';
119
119
  }
120
- if (client_1.daemonClient.enabled()) {
120
+ if (!client_1.daemonClient.enabled()) {
121
121
  output_1.output.error({
122
122
  title: 'Daemon is not running. The watch command is not supported without the Nx Daemon.',
123
123
  });
Binary file
@@ -1,10 +1,10 @@
1
- import { TasksRunner } from './tasks-runner';
2
- import { NxArgs } from '../utils/command-line-utils';
3
- import { LifeCycle } from './life-cycle';
4
- import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
5
1
  import { NxJsonConfiguration } from '../config/nx-json';
2
+ import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
6
3
  import { Task, TaskGraph } from '../config/task-graph';
7
4
  import { TargetDependencyConfig } from '../config/workspace-json-project-json';
5
+ import { NxArgs } from '../utils/command-line-utils';
6
+ import { LifeCycle } from './life-cycle';
7
+ import { TasksRunner } from './tasks-runner';
8
8
  export declare function runCommand(projectsToRun: ProjectGraphProjectNode[], projectGraph: ProjectGraph, { nxJson }: {
9
9
  nxJson: NxJsonConfiguration;
10
10
  }, nxArgs: NxArgs, overrides: any, initiatingProject: string | null, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, extraOptions: {
@@ -5,28 +5,28 @@ exports.invokeTasksRunner = invokeTasksRunner;
5
5
  exports.getRunner = getRunner;
6
6
  exports.getRunnerOptions = getRunnerOptions;
7
7
  const path_1 = require("path");
8
- const workspace_root_1 = require("../utils/workspace-root");
8
+ const nx_json_1 = require("../config/nx-json");
9
+ const client_1 = require("../daemon/client/client");
10
+ const create_task_hasher_1 = require("../hasher/create-task-hasher");
11
+ const hash_task_1 = require("../hasher/hash-task");
9
12
  const fileutils_1 = require("../utils/fileutils");
13
+ const is_ci_1 = require("../utils/is-ci");
14
+ const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
10
15
  const output_1 = require("../utils/output");
11
- const utils_1 = require("./utils");
16
+ const params_1 = require("../utils/params");
17
+ const workspace_root_1 = require("../utils/workspace-root");
18
+ const create_task_graph_1 = require("./create-task-graph");
12
19
  const life_cycle_1 = require("./life-cycle");
13
- const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/static-run-many-terminal-output-life-cycle");
14
- const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
15
- const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
16
20
  const dynamic_run_many_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-many-terminal-output-life-cycle");
17
- const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
18
- const is_ci_1 = require("../utils/is-ci");
19
21
  const dynamic_run_one_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-one-terminal-output-life-cycle");
20
- const nx_json_1 = require("../config/nx-json");
21
- const create_task_graph_1 = require("./create-task-graph");
22
- const task_graph_utils_1 = require("./task-graph-utils");
23
- const params_1 = require("../utils/params");
24
- const hash_task_1 = require("../hasher/hash-task");
25
- const client_1 = require("../daemon/client/client");
22
+ const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/static-run-many-terminal-output-life-cycle");
23
+ const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
26
24
  const store_run_information_life_cycle_1 = require("./life-cycles/store-run-information-life-cycle");
27
- const create_task_hasher_1 = require("../hasher/create-task-hasher");
28
25
  const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
29
- const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
26
+ const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
27
+ const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
28
+ const task_graph_utils_1 = require("./task-graph-utils");
29
+ const utils_1 = require("./utils");
30
30
  async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides) {
31
31
  const { runnerOptions } = getRunner(nxArgs, nxJson);
32
32
  const isRunOne = initiatingProject != null;
@@ -64,7 +64,7 @@ async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks
64
64
  }
65
65
  }
66
66
  }
67
- function createTaskGraphAndValidateCycles(projectGraph, extraTargetDependencies, projectNames, nxArgs, overrides, extraOptions) {
67
+ function createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies, projectNames, nxArgs, overrides, extraOptions) {
68
68
  const taskGraph = (0, create_task_graph_1.createTaskGraph)(projectGraph, extraTargetDependencies, projectNames, nxArgs.targets, nxArgs.configuration, overrides, extraOptions.excludeTaskDependencies);
69
69
  const cycle = (0, task_graph_utils_1.findCycle)(taskGraph);
70
70
  if (cycle) {
@@ -83,12 +83,17 @@ function createTaskGraphAndValidateCycles(projectGraph, extraTargetDependencies,
83
83
  process.exit(1);
84
84
  }
85
85
  }
86
+ // validate that no atomized tasks like e2e-ci are used without Nx Cloud
87
+ if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)()) &&
88
+ !process.env['NX_SKIP_ATOMIZER_VALIDATION']) {
89
+ (0, task_graph_utils_1.validateNoAtomizedTasks)(taskGraph, projectGraph);
90
+ }
86
91
  return taskGraph;
87
92
  }
88
93
  async function runCommand(projectsToRun, projectGraph, { nxJson }, nxArgs, overrides, initiatingProject, extraTargetDependencies, extraOptions) {
89
94
  const status = await (0, params_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
90
95
  const projectNames = projectsToRun.map((t) => t.name);
91
- const taskGraph = createTaskGraphAndValidateCycles(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
96
+ const taskGraph = createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
92
97
  const tasks = Object.values(taskGraph.tasks);
93
98
  const { lifeCycle, renderIsDone } = await getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides);
94
99
  const status = await invokeTasksRunner({
@@ -1,3 +1,5 @@
1
+ import { ProjectGraph } from '../config/project-graph';
2
+ import { TaskGraph } from '../config/task-graph';
1
3
  export declare function findCycle(graph: {
2
4
  dependencies: Record<string, string[]>;
3
5
  }): string[] | null;
@@ -5,3 +7,4 @@ export declare function makeAcyclic(graph: {
5
7
  roots: string[];
6
8
  dependencies: Record<string, string[]>;
7
9
  }): void;
10
+ export declare function validateNoAtomizedTasks(taskGraph: TaskGraph, projectGraph: ProjectGraph): void;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findCycle = findCycle;
4
4
  exports.makeAcyclic = makeAcyclic;
5
+ exports.validateNoAtomizedTasks = validateNoAtomizedTasks;
6
+ const output_1 = require("../utils/output");
5
7
  function _findCycle(graph, id, visited, path) {
6
8
  if (visited[id])
7
9
  return null;
@@ -52,3 +54,35 @@ function makeAcyclic(graph) {
52
54
  }
53
55
  graph.roots = Object.keys(graph.dependencies).filter((t) => graph.dependencies[t].length === 0);
54
56
  }
57
+ function validateNoAtomizedTasks(taskGraph, projectGraph) {
58
+ const getNonAtomizedTargetForTask = (task) => projectGraph.nodes[task.target.project]?.data?.targets?.[task.target.target]
59
+ ?.metadata?.nonAtomizedTarget;
60
+ const atomizedRootTasks = Object.values(taskGraph.tasks).filter((task) => getNonAtomizedTargetForTask(task) !== undefined);
61
+ if (atomizedRootTasks.length === 0) {
62
+ return;
63
+ }
64
+ const nonAtomizedTasks = atomizedRootTasks
65
+ .map((t) => `"${getNonAtomizedTargetForTask(t)}"`)
66
+ .filter((item, index, arr) => arr.indexOf(item) === index);
67
+ const moreInfoLines = [
68
+ `Please enable Nx Cloud or use the slower ${nonAtomizedTasks.join(',')} task${nonAtomizedTasks.length > 1 ? 's' : ''}.`,
69
+ 'Learn more at https://nx.dev/ci/features/split-e2e-tasks#use-atomizer-only-with-nx-cloud-distribution',
70
+ ];
71
+ if (atomizedRootTasks.length === 1) {
72
+ output_1.output.error({
73
+ title: `The ${atomizedRootTasks[0].id} task should only be run with Nx Cloud.`,
74
+ bodyLines: [...moreInfoLines],
75
+ });
76
+ }
77
+ else {
78
+ output_1.output.error({
79
+ title: `The following tasks should only be run with Nx Cloud:`,
80
+ bodyLines: [
81
+ ...atomizedRootTasks.map((task) => ` - ${task.id}`),
82
+ '',
83
+ ...moreInfoLines,
84
+ ],
85
+ });
86
+ }
87
+ process.exit(1);
88
+ }