nx 19.4.0-canary.20240626-3a2e8d4 → 19.4.0-canary.20240627-c2c6a13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/package.json +14 -14
  2. package/src/command-line/connect/connect-to-nx-cloud.d.ts +1 -1
  3. package/src/command-line/connect/connect-to-nx-cloud.js +16 -25
  4. package/src/command-line/graph/graph.d.ts +1 -0
  5. package/src/command-line/graph/graph.js +12 -1
  6. package/src/command-line/run/command-object.js +2 -1
  7. package/src/config/workspace-json-project-json.d.ts +1 -0
  8. package/src/core/graph/main.js +1 -1
  9. package/src/core/graph/styles.css +1 -1
  10. package/src/daemon/socket-utils.d.ts +1 -0
  11. package/src/daemon/socket-utils.js +6 -1
  12. package/src/executors/run-commands/run-commands.impl.js +19 -14
  13. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
  14. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +68 -33
  15. package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +5 -0
  16. package/src/nx-cloud/utilities/url-shorten.d.ts +2 -1
  17. package/src/nx-cloud/utilities/url-shorten.js +47 -11
  18. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +9 -2
  19. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +5 -0
  20. package/src/project-graph/plugins/internal-api.js +1 -1
  21. package/src/project-graph/plugins/isolation/index.d.ts +1 -1
  22. package/src/project-graph/plugins/isolation/index.js +3 -15
  23. package/src/project-graph/plugins/isolation/messaging.d.ts +6 -3
  24. package/src/project-graph/plugins/isolation/messaging.js +9 -3
  25. package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
  26. package/src/project-graph/plugins/isolation/plugin-pool.js +125 -51
  27. package/src/project-graph/plugins/isolation/plugin-worker.js +128 -107
  28. package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
  29. package/src/tasks-runner/task-env.d.ts +13 -0
  30. package/src/tasks-runner/task-env.js +41 -26
  31. package/src/utils/git-utils.d.ts +1 -1
  32. package/src/utils/git-utils.js +13 -2
  33. package/src/utils/nx-cloud-utils.d.ts +1 -1
  34. package/src/utils/nx-cloud-utils.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.4.0-canary.20240626-3a2e8d4",
3
+ "version": "19.4.0-canary.20240627-c2c6a13",
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": {
@@ -45,8 +45,8 @@
45
45
  "cli-cursor": "3.1.0",
46
46
  "cli-spinners": "2.6.1",
47
47
  "cliui": "^8.0.1",
48
- "dotenv": "~16.3.1",
49
- "dotenv-expand": "~10.0.0",
48
+ "dotenv": "~16.4.5",
49
+ "dotenv-expand": "~11.0.6",
50
50
  "enquirer": "~2.3.6",
51
51
  "figures": "3.2.0",
52
52
  "flat": "^5.0.2",
@@ -70,7 +70,7 @@
70
70
  "yargs-parser": "21.1.1",
71
71
  "node-machine-id": "1.1.12",
72
72
  "ora": "5.3.0",
73
- "@nrwl/tao": "19.4.0-canary.20240626-3a2e8d4"
73
+ "@nrwl/tao": "19.4.0-canary.20240627-c2c6a13"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "@swc-node/register": "^1.8.0",
@@ -85,16 +85,16 @@
85
85
  }
86
86
  },
87
87
  "optionalDependencies": {
88
- "@nx/nx-darwin-x64": "19.4.0-canary.20240626-3a2e8d4",
89
- "@nx/nx-darwin-arm64": "19.4.0-canary.20240626-3a2e8d4",
90
- "@nx/nx-linux-x64-gnu": "19.4.0-canary.20240626-3a2e8d4",
91
- "@nx/nx-linux-x64-musl": "19.4.0-canary.20240626-3a2e8d4",
92
- "@nx/nx-win32-x64-msvc": "19.4.0-canary.20240626-3a2e8d4",
93
- "@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240626-3a2e8d4",
94
- "@nx/nx-linux-arm64-musl": "19.4.0-canary.20240626-3a2e8d4",
95
- "@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240626-3a2e8d4",
96
- "@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240626-3a2e8d4",
97
- "@nx/nx-freebsd-x64": "19.4.0-canary.20240626-3a2e8d4"
88
+ "@nx/nx-darwin-x64": "19.4.0-canary.20240627-c2c6a13",
89
+ "@nx/nx-darwin-arm64": "19.4.0-canary.20240627-c2c6a13",
90
+ "@nx/nx-linux-x64-gnu": "19.4.0-canary.20240627-c2c6a13",
91
+ "@nx/nx-linux-x64-musl": "19.4.0-canary.20240627-c2c6a13",
92
+ "@nx/nx-win32-x64-msvc": "19.4.0-canary.20240627-c2c6a13",
93
+ "@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240627-c2c6a13",
94
+ "@nx/nx-linux-arm64-musl": "19.4.0-canary.20240627-c2c6a13",
95
+ "@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240627-c2c6a13",
96
+ "@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240627-c2c6a13",
97
+ "@nx/nx-freebsd-x64": "19.4.0-canary.20240627-c2c6a13"
98
98
  },
99
99
  "nx-migrations": {
100
100
  "migrations": "./migrations.json",
@@ -3,6 +3,6 @@ import { NxArgs } from '../../utils/command-line-utils';
3
3
  import { MessageKey } from '../../utils/ab-testing';
4
4
  export declare function onlyDefaultRunnerIsUsed(nxJson: NxJsonConfiguration): boolean;
5
5
  export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>;
6
- export declare function connectToNxCloudCommand(): Promise<boolean>;
6
+ export declare function connectToNxCloudCommand(command?: string): Promise<boolean>;
7
7
  export declare function connectToNxCloudWithPrompt(command: string): Promise<void>;
8
8
  export declare function connectExistingRepoToNxCloudPrompt(key?: MessageKey): Promise<boolean>;
@@ -41,38 +41,29 @@ async function connectToNxCloudIfExplicitlyAsked(opts) {
41
41
  }
42
42
  }
43
43
  exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked;
44
- async function connectToNxCloudCommand() {
44
+ async function connectToNxCloudCommand(command) {
45
45
  const nxJson = (0, configuration_1.readNxJson)();
46
46
  if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
47
- if (process.env.NX_NEW_CLOUD_ONBOARDING !== 'true') {
48
- output_1.output.log({
49
- title: '✔ This workspace already has Nx Cloud set up',
50
- bodyLines: [
51
- 'If you have not done so already, connect your workspace to your Nx Cloud account:',
52
- `- Login at ${(0, nx_cloud_utils_1.getNxCloudUrl)(nxJson)} to connect your repository`,
53
- ],
54
- });
47
+ const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;
48
+ if (!token) {
49
+ throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
55
50
  }
56
- else {
57
- const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;
58
- if (!token) {
59
- throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
60
- }
61
- const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)('nx-connect', token);
62
- output_1.output.log({
63
- title: '✔ This workspace already has Nx Cloud set up',
64
- bodyLines: [
65
- 'If you have not done so already, connect your workspace to your Nx Cloud account:',
66
- `- Connect with Nx Cloud at:
51
+ const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)('nx-connect', token);
52
+ output_1.output.log({
53
+ title: '✔ This workspace already has Nx Cloud set up',
54
+ bodyLines: [
55
+ 'If you have not done so already, connect your workspace to your Nx Cloud account:',
56
+ `- Connect with Nx Cloud at:
67
57
 
68
58
  ${connectCloudUrl}`,
69
- ],
70
- });
71
- }
59
+ ],
60
+ });
72
61
  return false;
73
62
  }
74
63
  const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud');
75
- const callback = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, {});
64
+ const callback = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, {
65
+ installationSource: command ?? 'nx-connect',
66
+ });
76
67
  tree.lock();
77
68
  (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges());
78
69
  await callback();
@@ -81,7 +72,7 @@ async function connectToNxCloudCommand() {
81
72
  exports.connectToNxCloudCommand = connectToNxCloudCommand;
82
73
  async function connectToNxCloudWithPrompt(command) {
83
74
  const setNxCloud = await nxCloudPrompt('setupNxCloud');
84
- const useCloud = setNxCloud === 'yes' ? await connectToNxCloudCommand() : false;
75
+ const useCloud = setNxCloud === 'yes' ? await connectToNxCloudCommand(command) : false;
85
76
  await (0, ab_testing_1.recordStat)({
86
77
  command,
87
78
  nxVersion: versions_1.nxVersion,
@@ -23,6 +23,7 @@ export interface ProjectGraphClientResponse {
23
23
  exclude: string[];
24
24
  isPartial: boolean;
25
25
  errors?: GraphError[];
26
+ connectedToCloud?: boolean;
26
27
  }
27
28
  export interface TaskGraphClientResponse {
28
29
  taskGraphs: Record<string, TaskGraph>;
@@ -28,6 +28,7 @@ const nx_deps_cache_1 = require("../../project-graph/nx-deps-cache");
28
28
  const create_task_hasher_1 = require("../../hasher/create-task-hasher");
29
29
  const task_hasher_1 = require("../../hasher/task-hasher");
30
30
  const error_types_1 = require("../../project-graph/error-types");
31
+ const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
31
32
  // maps file extention to MIME types
32
33
  const mimeType = {
33
34
  '.ico': 'image/x-icon',
@@ -478,10 +479,12 @@ async function createProjectGraphAndSourceMapClientResponse(affected = []) {
478
479
  let sourceMaps;
479
480
  let isPartial = false;
480
481
  let errors;
482
+ let connectedToCloud;
481
483
  try {
482
484
  const projectGraphAndSourceMaps = await (0, project_graph_1.createProjectGraphAndSourceMapsAsync)({ exitOnError: false });
483
485
  projectGraph = projectGraphAndSourceMaps.projectGraph;
484
486
  sourceMaps = projectGraphAndSourceMaps.sourceMaps;
487
+ connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, configuration_1.readNxJson)());
485
488
  }
486
489
  catch (e) {
487
490
  if (e instanceof error_types_1.ProjectGraphError) {
@@ -509,7 +512,14 @@ async function createProjectGraphAndSourceMapClientResponse(affected = []) {
509
512
  const projects = Object.values(graph.nodes);
510
513
  const dependencies = graph.dependencies;
511
514
  const hasher = (0, crypto_1.createHash)('sha256');
512
- hasher.update(JSON.stringify({ layout, projects, dependencies, sourceMaps, errors }));
515
+ hasher.update(JSON.stringify({
516
+ layout,
517
+ projects,
518
+ dependencies,
519
+ sourceMaps,
520
+ errors,
521
+ connectedToCloud,
522
+ }));
513
523
  const hash = hasher.digest('hex');
514
524
  perf_hooks_1.performance.mark('project graph response generation:end');
515
525
  perf_hooks_1.performance.measure('project graph watch calculation', 'project graph watch calculation:start', 'project graph watch calculation:end');
@@ -525,6 +535,7 @@ async function createProjectGraphAndSourceMapClientResponse(affected = []) {
525
535
  fileMap,
526
536
  isPartial,
527
537
  errors,
538
+ connectedToCloud,
528
539
  },
529
540
  sourceMapResponse: sourceMaps,
530
541
  };
@@ -28,8 +28,9 @@ exports.yargsNxInfixCommand = {
28
28
  command: '$0 <target> [project] [_..]',
29
29
  describe: 'Run a target for a project',
30
30
  handler: async (args) => {
31
- await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
31
+ const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
32
32
  return (await Promise.resolve().then(() => require('./run-one'))).runOne(process.cwd(), (0, shared_options_1.withOverrides)(args, 0));
33
33
  });
34
+ process.exit(exitCode);
34
35
  },
35
36
  };
@@ -113,6 +113,7 @@ export interface TargetMetadata {
113
113
  [k: string]: any;
114
114
  description?: string;
115
115
  technologies?: string[];
116
+ nonAtomizedTarget?: string;
116
117
  }
117
118
  export interface TargetDependencyConfig {
118
119
  /**