nx 19.5.3 → 19.5.4

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 (37) hide show
  1. package/package.json +13 -13
  2. package/release/changelog-renderer/index.js +5 -4
  3. package/src/command-line/connect/connect-to-nx-cloud.d.ts +2 -0
  4. package/src/command-line/connect/connect-to-nx-cloud.js +33 -6
  5. package/src/command-line/connect/view-logs.js +5 -3
  6. package/src/command-line/examples.js +4 -0
  7. package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
  8. package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
  9. package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
  10. package/src/command-line/init/implementation/angular/index.js +1 -1
  11. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -1
  12. package/src/command-line/init/implementation/utils.d.ts +1 -1
  13. package/src/command-line/init/implementation/utils.js +7 -5
  14. package/src/command-line/init/init-v2.js +1 -4
  15. package/src/command-line/migrate/migrate.js +19 -7
  16. package/src/command-line/release/changelog.js +1 -0
  17. package/src/command-line/release/config/config.js +4 -0
  18. package/src/command-line/release/plan.js +2 -12
  19. package/src/command-line/release/utils/generate-version-plan-content.d.ts +1 -0
  20. package/src/command-line/release/utils/generate-version-plan-content.js +21 -0
  21. package/src/command-line/release/utils/shared.js +8 -5
  22. package/src/command-line/release/version.js +4 -2
  23. package/src/command-line/report/report.d.ts +1 -0
  24. package/src/command-line/report/report.js +14 -9
  25. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +6 -0
  26. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +15 -5
  27. package/src/native/index.d.ts +2 -0
  28. package/src/native/native-bindings.js +1 -0
  29. package/src/native/nx.wasi.cjs +35 -33
  30. package/src/native/nx.wasm32-wasi.wasm +0 -0
  31. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +3 -2
  32. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +18 -57
  33. package/src/nx-cloud/utilities/url-shorten.d.ts +1 -1
  34. package/src/nx-cloud/utilities/url-shorten.js +5 -7
  35. package/src/project-graph/plugins/internal-api.js +4 -1
  36. package/src/tasks-runner/task-env.js +3 -2
  37. package/src/tasks-runner/task-graph-utils.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.5.3",
3
+ "version": "19.5.4",
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": {
@@ -41,7 +41,7 @@
41
41
  "@yarnpkg/lockfile": "^1.1.0",
42
42
  "@yarnpkg/parsers": "3.0.0-rc.46",
43
43
  "@zkochan/js-yaml": "0.0.7",
44
- "axios": "^1.6.0",
44
+ "axios": "^1.7.2",
45
45
  "chalk": "^4.1.0",
46
46
  "cli-cursor": "3.1.0",
47
47
  "cli-spinners": "2.6.1",
@@ -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.5.3"
74
+ "@nrwl/tao": "19.5.4"
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.5.3",
90
- "@nx/nx-darwin-arm64": "19.5.3",
91
- "@nx/nx-linux-x64-gnu": "19.5.3",
92
- "@nx/nx-linux-x64-musl": "19.5.3",
93
- "@nx/nx-win32-x64-msvc": "19.5.3",
94
- "@nx/nx-linux-arm64-gnu": "19.5.3",
95
- "@nx/nx-linux-arm64-musl": "19.5.3",
96
- "@nx/nx-linux-arm-gnueabihf": "19.5.3",
97
- "@nx/nx-win32-arm64-msvc": "19.5.3",
98
- "@nx/nx-freebsd-x64": "19.5.3"
89
+ "@nx/nx-darwin-x64": "19.5.4",
90
+ "@nx/nx-darwin-arm64": "19.5.4",
91
+ "@nx/nx-linux-x64-gnu": "19.5.4",
92
+ "@nx/nx-linux-x64-musl": "19.5.4",
93
+ "@nx/nx-win32-x64-msvc": "19.5.4",
94
+ "@nx/nx-linux-arm64-gnu": "19.5.4",
95
+ "@nx/nx-linux-arm64-musl": "19.5.4",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.5.4",
97
+ "@nx/nx-win32-arm64-msvc": "19.5.4",
98
+ "@nx/nx-freebsd-x64": "19.5.4"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -25,10 +25,11 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
25
25
  }
26
26
  }
27
27
  }
28
+ let relevantChanges = changes;
28
29
  // workspace root level changelog
29
30
  if (project === null) {
30
31
  // No changes for the workspace
31
- if (changes.length === 0) {
32
+ if (relevantChanges.length === 0) {
32
33
  if (dependencyBumps?.length) {
33
34
  applyAdditionalDependencyBumps({
34
35
  markdownLines,
@@ -42,7 +43,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
42
43
  }
43
44
  return markdownLines.join('\n').trim();
44
45
  }
45
- const typeGroups = groupBy(changes, 'type');
46
+ const typeGroups = groupBy(relevantChanges, 'type');
46
47
  markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
47
48
  for (const type of Object.keys(changeTypes)) {
48
49
  const group = typeGroups[type];
@@ -75,7 +76,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
75
76
  }
76
77
  else {
77
78
  // project level changelog
78
- const relevantChanges = changes.filter((c) => c.affectedProjects &&
79
+ relevantChanges = relevantChanges.filter((c) => c.affectedProjects &&
79
80
  (c.affectedProjects === '*' || c.affectedProjects.includes(project)));
80
81
  // Generating for a named project, but that project has no relevant changes in the current set of commits, exit early
81
82
  if (relevantChanges.length === 0) {
@@ -128,7 +129,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
128
129
  }
129
130
  if (changelogRenderOptions.authors) {
130
131
  const _authors = new Map();
131
- for (const change of changes) {
132
+ for (const change of relevantChanges) {
132
133
  if (!change.author) {
133
134
  continue;
134
135
  }
@@ -1,8 +1,10 @@
1
+ import { ConnectToNxCloudOptions } from '../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud';
1
2
  import { NxJsonConfiguration } from '../../config/nx-json';
2
3
  import { NxArgs } from '../../utils/command-line-utils';
3
4
  import { MessageKey } from '../../utils/ab-testing';
4
5
  export declare function onlyDefaultRunnerIsUsed(nxJson: NxJsonConfiguration): boolean;
5
6
  export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>;
7
+ export declare function connectWorkspaceToCloud(options: ConnectToNxCloudOptions): Promise<string>;
6
8
  export declare function connectToNxCloudCommand(command?: string): Promise<boolean>;
7
9
  export declare function connectExistingRepoToNxCloudPrompt(command?: string, key?: MessageKey): Promise<boolean>;
8
10
  export declare function connectToNxCloudWithPrompt(command: string): Promise<void>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onlyDefaultRunnerIsUsed = onlyDefaultRunnerIsUsed;
4
4
  exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked;
5
+ exports.connectWorkspaceToCloud = connectWorkspaceToCloud;
5
6
  exports.connectToNxCloudCommand = connectToNxCloudCommand;
6
7
  exports.connectExistingRepoToNxCloudPrompt = connectExistingRepoToNxCloudPrompt;
7
8
  exports.connectToNxCloudWithPrompt = connectToNxCloudWithPrompt;
@@ -16,6 +17,8 @@ const ab_testing_1 = require("../../utils/ab-testing");
16
17
  const versions_1 = require("../../utils/versions");
17
18
  const workspace_root_1 = require("../../utils/workspace-root");
18
19
  const chalk = require("chalk");
20
+ const ora = require("ora");
21
+ const open = require("open");
19
22
  function onlyDefaultRunnerIsUsed(nxJson) {
20
23
  const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner;
21
24
  if (!defaultRunner) {
@@ -43,6 +46,13 @@ async function connectToNxCloudIfExplicitlyAsked(opts) {
43
46
  process.exit(0);
44
47
  }
45
48
  }
49
+ async function connectWorkspaceToCloud(options) {
50
+ const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud');
51
+ const accessToken = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, options);
52
+ tree.lock();
53
+ (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges());
54
+ return accessToken;
55
+ }
46
56
  async function connectToNxCloudCommand(command) {
47
57
  const nxJson = (0, configuration_1.readNxJson)();
48
58
  if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
@@ -50,7 +60,7 @@ async function connectToNxCloudCommand(command) {
50
60
  if (!token) {
51
61
  throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
52
62
  }
53
- const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)('nx-connect', token);
63
+ const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token);
54
64
  output_1.output.log({
55
65
  title: '✔ This workspace already has Nx Cloud set up',
56
66
  bodyLines: [
@@ -62,15 +72,32 @@ async function connectToNxCloudCommand(command) {
62
72
  });
63
73
  return false;
64
74
  }
65
- const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud');
66
- const callback = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, {
75
+ const token = await connectWorkspaceToCloud({
67
76
  installationSource: command ?? 'nx-connect',
68
77
  });
69
- tree.lock();
70
- (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges());
71
- await callback();
78
+ const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token);
79
+ try {
80
+ const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start();
81
+ await sleep(2000);
82
+ await open(connectCloudUrl);
83
+ cloudConnectSpinner.succeed();
84
+ }
85
+ catch (e) {
86
+ output_1.output.note({
87
+ title: `Your Nx Cloud workspace is ready.`,
88
+ bodyLines: [
89
+ `To claim it, connect it to your Nx Cloud account:`,
90
+ `- Go to the following URL to connect your workspace to Nx Cloud:`,
91
+ '',
92
+ `${connectCloudUrl}`,
93
+ ],
94
+ });
95
+ }
72
96
  return true;
73
97
  }
98
+ function sleep(ms) {
99
+ return new Promise((resolve) => setTimeout(resolve, ms));
100
+ }
74
101
  async function connectExistingRepoToNxCloudPrompt(command = 'init', key = 'setupNxCloud') {
75
102
  const res = await nxCloudPrompt(key).then((value) => value === 'yes');
76
103
  await (0, ab_testing_1.recordStat)({
@@ -5,9 +5,10 @@ const package_manager_1 = require("../../utils/package-manager");
5
5
  const child_process_1 = require("child_process");
6
6
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
7
7
  const output_1 = require("../../utils/output");
8
- const child_process_2 = require("../../utils/child-process");
9
8
  const nx_json_1 = require("../../config/nx-json");
10
9
  const connect_to_nx_cloud_1 = require("./connect-to-nx-cloud");
10
+ const connect_to_nx_cloud_2 = require("../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
11
+ const url_shorten_1 = require("../../nx-cloud/utilities/url-shorten");
11
12
  async function viewLogs() {
12
13
  const cloudUsed = (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)());
13
14
  if (cloudUsed) {
@@ -27,9 +28,10 @@ async function viewLogs() {
27
28
  output_1.output.log({
28
29
  title: 'Connecting to Nx Cloud',
29
30
  });
30
- (0, child_process_2.runNxSync)(`g nx:connect-to-nx-cloud --installation-source=view-logs --quiet --no-interactive`, {
31
- stdio: 'ignore',
31
+ const token = await (0, connect_to_nx_cloud_1.connectWorkspaceToCloud)({
32
+ installationSource: 'view-logs',
32
33
  });
34
+ await (0, connect_to_nx_cloud_2.printSuccessMessage)(token, 'view-logs', await (0, url_shorten_1.repoUsesGithub)());
33
35
  }
34
36
  catch (e) {
35
37
  output_1.output.log({
@@ -311,6 +311,10 @@ exports.examples = {
311
311
  command: 'show projects --projects api-*',
312
312
  description: 'Show all projects with names starting with "api-". The "projects" option is useful to see which projects would be selected by run-many',
313
313
  },
314
+ {
315
+ command: 'show projects --projects tag:ui-*',
316
+ description: 'Show all projects with a tag starting with "ui-". The "projects" option is useful to see which projects would be selected by run-many',
317
+ },
314
318
  {
315
319
  command: 'show projects --with-target serve',
316
320
  description: 'Show all projects with a serve target',
@@ -74,7 +74,7 @@ async function addNxToMonorepo(options) {
74
74
  (0, utils_1.runInstall)(repoRoot);
75
75
  if (useNxCloud) {
76
76
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
77
- (0, utils_1.initCloud)(repoRoot, 'nx-init-monorepo');
77
+ await (0, utils_1.initCloud)('nx-init-monorepo');
78
78
  }
79
79
  }
80
80
  // scanning package.json files
@@ -93,7 +93,7 @@ async function addNxToNest(options, packageJson) {
93
93
  (0, utils_1.runInstall)(repoRoot);
94
94
  if (useNxCloud) {
95
95
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
96
- (0, utils_1.initCloud)(repoRoot, 'nx-init-nest');
96
+ await (0, utils_1.initCloud)('nx-init-nest');
97
97
  }
98
98
  }
99
99
  function addNestPluginToPackageJson(repoRoot) {
@@ -67,6 +67,6 @@ async function addNxToNpmRepo(options) {
67
67
  (0, utils_1.runInstall)(repoRoot, pmc);
68
68
  if (useNxCloud) {
69
69
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
70
- (0, utils_1.initCloud)(repoRoot, 'nx-init-npm-repo');
70
+ await (0, utils_1.initCloud)('nx-init-npm-repo');
71
71
  }
72
72
  }
@@ -44,7 +44,7 @@ async function addNxToAngularCliRepo(options) {
44
44
  await setupWorkspace(cacheableOperations, options.integrated);
45
45
  if (useNxCloud) {
46
46
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
47
- (0, utils_1.initCloud)(repoRoot, 'nx-init-angular');
47
+ await (0, utils_1.initCloud)('nx-init-angular');
48
48
  }
49
49
  }
50
50
  async function collectCacheableOperations(options) {
@@ -85,7 +85,7 @@ async function getLegacyMigrationFunctionIfApplicable(repoRoot, options) {
85
85
  (0, child_process_1.execSync)(`${pmc.exec} ${legacyMigrationCommand}`, { stdio: [0, 1, 2] });
86
86
  if (useNxCloud) {
87
87
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
88
- (0, utils_1.initCloud)(repoRoot, 'nx-init-angular');
88
+ await (0, utils_1.initCloud)('nx-init-angular');
89
89
  }
90
90
  };
91
91
  }
@@ -6,7 +6,7 @@ export declare function createNxJsonFile(repoRoot: string, topologicalTargets: s
6
6
  export declare function addDepsToPackageJson(repoRoot: string, additionalPackages?: string[]): void;
7
7
  export declare function updateGitIgnore(root: string): void;
8
8
  export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommands): void;
9
- export declare function initCloud(repoRoot: string, installationSource: 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): void;
9
+ export declare function initCloud(installationSource: 'nx-init' | 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): Promise<void>;
10
10
  export declare function addVsCodeRecommendedExtensions(repoRoot: string, extensions: string[]): void;
11
11
  export declare function markRootPackageJsonAsNxProjectLegacy(repoRoot: string, cacheableScripts: string[], pmc: PackageManagerCommands): void;
12
12
  export declare function markPackageJsonAsNxProject(packageJsonPath: string): void;
@@ -12,13 +12,15 @@ exports.printFinalMessage = printFinalMessage;
12
12
  exports.isMonorepo = isMonorepo;
13
13
  const child_process_1 = require("child_process");
14
14
  const path_1 = require("path");
15
- const child_process_2 = require("../../../utils/child-process");
16
15
  const fileutils_1 = require("../../../utils/fileutils");
17
16
  const output_1 = require("../../../utils/output");
18
17
  const package_manager_1 = require("../../../utils/package-manager");
19
18
  const path_2 = require("../../../utils/path");
20
19
  const versions_1 = require("../../../utils/versions");
21
20
  const fs_1 = require("fs");
21
+ const connect_to_nx_cloud_1 = require("../../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
22
+ const url_shorten_1 = require("../../../nx-cloud/utilities/url-shorten");
23
+ const connect_to_nx_cloud_2 = require("../../connect/connect-to-nx-cloud");
22
24
  function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scriptOutputs) {
23
25
  const nxJsonPath = (0, path_2.joinPathFragments)(repoRoot, 'nx.json');
24
26
  let nxJson = {};
@@ -128,11 +130,11 @@ function updateGitIgnore(root) {
128
130
  function runInstall(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
129
131
  (0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot });
130
132
  }
131
- function initCloud(repoRoot, installationSource) {
132
- (0, child_process_2.runNxSync)(`g nx:connect-to-nx-cloud --installationSource=${installationSource} --quiet --no-interactive`, {
133
- stdio: [0, 1, 2],
134
- cwd: repoRoot,
133
+ async function initCloud(installationSource) {
134
+ const token = await (0, connect_to_nx_cloud_2.connectWorkspaceToCloud)({
135
+ installationSource,
135
136
  });
137
+ await (0, connect_to_nx_cloud_1.printSuccessMessage)(token, installationSource, await (0, url_shorten_1.repoUsesGithub)());
136
138
  }
137
139
  function addVsCodeRecommendedExtensions(repoRoot, extensions) {
138
140
  const vsCodeExtensionsPath = (0, path_1.join)(repoRoot, '.vscode/extensions.json');
@@ -90,10 +90,7 @@ async function initHandler(options) {
90
90
  }
91
91
  if (useNxCloud) {
92
92
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
93
- (0, child_process_2.execSync)(`${pmc.exec} nx g nx:connect-to-nx-cloud --installationSource=nx-init --quiet --hideFormatLogs --no-interactive`, {
94
- stdio: [0, 1, 2],
95
- cwd: repoRoot,
96
- });
93
+ await (0, utils_1.initCloud)('nx-init');
97
94
  }
98
95
  (0, utils_1.printFinalMessage)({
99
96
  learnMoreLink,
@@ -30,6 +30,7 @@ const child_process_2 = require("../../utils/child-process");
30
30
  const client_1 = require("../../daemon/client/client");
31
31
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
32
32
  const project_graph_1 = require("../../project-graph/project-graph");
33
+ const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
33
34
  const execAsync = (0, util_1.promisify)(child_process_1.exec);
34
35
  function normalizeVersion(version) {
35
36
  const [semver, ...prereleaseTagParts] = version.split('-');
@@ -669,10 +670,10 @@ function readPackageMigrationConfig(packageName, dir) {
669
670
  };
670
671
  }
671
672
  }
672
- function createMigrationsFile(root, migrations) {
673
- (0, fileutils_1.writeJsonFile)((0, path_1.join)(root, 'migrations.json'), { migrations });
673
+ async function createMigrationsFile(root, migrations) {
674
+ await writeFormattedJsonFile((0, path_1.join)(root, 'migrations.json'), { migrations });
674
675
  }
675
- function updatePackageJson(root, updatedPackages) {
676
+ async function updatePackageJson(root, updatedPackages) {
676
677
  const packageJsonPath = (0, path_1.join)(root, 'package.json');
677
678
  if (!(0, fs_1.existsSync)(packageJsonPath)) {
678
679
  return;
@@ -694,7 +695,7 @@ function updatePackageJson(root, updatedPackages) {
694
695
  json[dependencyType][p] = updatedPackages[p].version;
695
696
  }
696
697
  });
697
- (0, fileutils_1.writeJsonFile)(packageJsonPath, json, {
698
+ await writeFormattedJsonFile(packageJsonPath, json, {
698
699
  appendNewLine: parseOptions.endsWithNewline,
699
700
  });
700
701
  }
@@ -719,7 +720,7 @@ async function updateInstallationDetails(root, updatedPackages) {
719
720
  }
720
721
  }
721
722
  }
722
- (0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson, {
723
+ await writeFormattedJsonFile(nxJsonPath, nxJson, {
723
724
  appendNewLine: parseOptions.endsWithNewline,
724
725
  });
725
726
  }
@@ -765,10 +766,10 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
765
766
  excludeAppliedMigrations: opts.excludeAppliedMigrations,
766
767
  });
767
768
  const { migrations, packageUpdates, minVersionWithSkippedUpdates } = await migrator.migrate(opts.targetPackage, opts.targetVersion);
768
- updatePackageJson(root, packageUpdates);
769
+ await updatePackageJson(root, packageUpdates);
769
770
  await updateInstallationDetails(root, packageUpdates);
770
771
  if (migrations.length > 0) {
771
- createMigrationsFile(root, [
772
+ await createMigrationsFile(root, [
772
773
  ...addSplitConfigurationMigrationIfAvailable(from, packageUpdates),
773
774
  ...migrations,
774
775
  ]);
@@ -835,6 +836,17 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
835
836
  throw e;
836
837
  }
837
838
  }
839
+ async function writeFormattedJsonFile(filePath, content, options) {
840
+ const formattedContent = await (0, format_changed_files_with_prettier_if_available_1.formatFilesWithPrettierIfAvailable)([{ path: filePath, content: JSON.stringify(content) }], workspace_root_1.workspaceRoot, { silent: true });
841
+ if (formattedContent.has(filePath)) {
842
+ (0, fs_1.writeFileSync)(filePath, formattedContent.get(filePath), {
843
+ encoding: 'utf-8',
844
+ });
845
+ }
846
+ else {
847
+ (0, fileutils_1.writeJsonFile)(filePath, content, options);
848
+ }
849
+ }
838
850
  function addSplitConfigurationMigrationIfAvailable(from, packageJson) {
839
851
  if (!packageJson['@nrwl/workspace'])
840
852
  return [];
@@ -296,6 +296,7 @@ async function releaseChangelog(args) {
296
296
  let fromRef = args.from ||
297
297
  (await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {
298
298
  projectName: project.name,
299
+ releaseGroupName: releaseGroup.name,
299
300
  }))?.tag;
300
301
  if (!fromRef && useAutomaticFromRef) {
301
302
  const firstCommit = await (0, git_1.getFirstGitCommit)();
@@ -73,6 +73,10 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
73
73
  tag: true,
74
74
  };
75
75
  const defaultFixedReleaseTagPattern = 'v{version}';
76
+ /**
77
+ * TODO: in v20, make it so that this pattern is used by default when any custom groups are used
78
+ */
79
+ const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}';
76
80
  const defaultIndependentReleaseTagPattern = '{projectName}@{version}';
77
81
  const workspaceProjectsRelationship = userConfig.projectsRelationship || 'fixed';
78
82
  const defaultGeneratorOptions = {};
@@ -14,6 +14,7 @@ const params_1 = require("../../utils/params");
14
14
  const config_1 = require("./config/config");
15
15
  const filter_release_groups_1 = require("./config/filter-release-groups");
16
16
  const version_plans_1 = require("./config/version-plans");
17
+ const generate_version_plan_content_1 = require("./utils/generate-version-plan-content");
17
18
  const git_1 = require("./utils/git");
18
19
  const print_changes_1 = require("./utils/print-changes");
19
20
  const releasePlanCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => releasePlan(args));
@@ -94,7 +95,7 @@ async function releasePlan(args) {
94
95
  return 0;
95
96
  }
96
97
  const versionPlanMessage = args.message || (await promptForMessage());
97
- const versionPlanFileContent = getVersionPlanFileContent(versionPlanBumps, versionPlanMessage);
98
+ const versionPlanFileContent = (0, generate_version_plan_content_1.generateVersionPlanContent)(versionPlanBumps, versionPlanMessage);
98
99
  const versionPlanFileName = `version-plan-${new Date().getTime()}.md`;
99
100
  if (args.dryRun) {
100
101
  output_1.output.logSingleLine(`Would create version plan file "${versionPlanFileName}", but --dry-run was set.`);
@@ -171,14 +172,3 @@ async function _promptForMessage() {
171
172
  process.exit(0);
172
173
  }
173
174
  }
174
- function getVersionPlanFileContent(bumps, message) {
175
- return `---
176
- ${Object.entries(bumps)
177
- .filter(([_, version]) => version !== 'none')
178
- .map(([projectOrGroup, version]) => `${projectOrGroup}: ${version}`)
179
- .join('\n')}
180
- ---
181
-
182
- ${message}
183
- `;
184
- }
@@ -0,0 +1 @@
1
+ export declare function generateVersionPlanContent(bumps: Record<string, string>, message: string): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateVersionPlanContent = generateVersionPlanContent;
4
+ function generateVersionPlanContent(bumps, message) {
5
+ return `---
6
+ ${Object.entries(bumps)
7
+ .filter(([_, version]) => version !== 'none')
8
+ .map(([projectOrGroup, version]) => {
9
+ let key = projectOrGroup;
10
+ // frontmatter parsing will blow up if we don't wrap @org/package style project names in quotes
11
+ if (key.startsWith('@')) {
12
+ key = `'${key}'`;
13
+ }
14
+ return `${key}: ${version}`;
15
+ })
16
+ .join('\n')}
17
+ ---
18
+
19
+ ${message}
20
+ `;
21
+ }
@@ -128,11 +128,13 @@ function createCommitMessageValues(releaseGroups, releaseGroupToFilteredProjects
128
128
  }
129
129
  // One entry for the whole group for fixed groups
130
130
  const projectVersionData = versionData[releaseGroupProjectNames[0]]; // all at the same version, so we can just pick the first one
131
- const releaseVersion = new ReleaseVersion({
132
- version: projectVersionData.newVersion,
133
- releaseTagPattern: releaseGroup.releaseTagPattern,
134
- });
135
- commitMessageValues.push(`- release-group: ${releaseGroup.name} ${releaseVersion.rawVersion}`);
131
+ if (projectVersionData.newVersion !== null) {
132
+ const releaseVersion = new ReleaseVersion({
133
+ version: projectVersionData.newVersion,
134
+ releaseTagPattern: releaseGroup.releaseTagPattern,
135
+ });
136
+ commitMessageValues.push(`- release-group: ${releaseGroup.name} ${releaseVersion.rawVersion}`);
137
+ }
136
138
  }
137
139
  return commitMessageValues;
138
140
  }
@@ -169,6 +171,7 @@ function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versi
169
171
  if (projectVersionData.newVersion !== null) {
170
172
  tags.push((0, utils_1.interpolate)(releaseGroup.releaseTagPattern, {
171
173
  version: projectVersionData.newVersion,
174
+ releaseGroupName: releaseGroup.name,
172
175
  }));
173
176
  }
174
177
  }
@@ -140,8 +140,9 @@ async function releaseVersion(args) {
140
140
  ...tree.listChanges().map((f) => f.path),
141
141
  ...additionalChangedFiles,
142
142
  ];
143
+ const deletedFiles = Array.from(additionalDeletedFiles);
143
144
  // No further actions are necessary in this scenario (e.g. if conventional commits detected no changes)
144
- if (!changedFiles.length) {
145
+ if (!changedFiles.length && !deletedFiles.length) {
145
146
  return {
146
147
  // An overall workspace version cannot be relevant when filtering to independent projects
147
148
  workspaceVersion: undefined,
@@ -151,7 +152,7 @@ async function releaseVersion(args) {
151
152
  if (args.gitCommit ?? nxReleaseConfig.version.git.commit) {
152
153
  await (0, shared_1.commitChanges)({
153
154
  changedFiles,
154
- deletedFiles: Array.from(additionalDeletedFiles),
155
+ deletedFiles,
155
156
  isDryRun: !!args.dryRun,
156
157
  isVerbose: !!args.verbose,
157
158
  gitCommitMessages: (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage),
@@ -162,6 +163,7 @@ async function releaseVersion(args) {
162
163
  output_1.output.logSingleLine(`Staging changed files with git`);
163
164
  await (0, git_1.gitAdd)({
164
165
  changedFiles,
166
+ deletedFiles,
165
167
  dryRun: args.dryRun,
166
168
  verbose: args.verbose,
167
169
  });
@@ -31,6 +31,7 @@ export interface ReportData {
31
31
  migrateTarget: string;
32
32
  };
33
33
  projectGraphError?: Error | null;
34
+ nativeTarget: string | null;
34
35
  }
35
36
  export declare function getReportData(): Promise<ReportData>;
36
37
  interface OutOfSyncPackageGroup {
@@ -43,14 +43,18 @@ const LINE_SEPARATOR = '---------------------------------------';
43
43
  *
44
44
  */
45
45
  async function reportHandler() {
46
- const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData();
47
- const bodyLines = [
48
- `Node : ${process.versions.node}`,
49
- `OS : ${process.platform}-${process.arch}`,
50
- `${pm.padEnd(7)}: ${pmVersion}`,
51
- ``,
46
+ const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
47
+ const fields = [
48
+ ['Node', process.versions.node],
49
+ ['OS', `${process.platform}-${process.arch}`],
50
+ ['Native Target', nativeTarget ?? 'Unavailable'],
51
+ [pm, pmVersion],
52
52
  ];
53
- let padding = Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1;
53
+ let padding = Math.max(...fields.map((f) => f[0].length));
54
+ const bodyLines = fields.map(([field, value]) => `${field.padEnd(padding)} : ${value}`);
55
+ bodyLines.push('');
56
+ padding =
57
+ Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1;
54
58
  packageVersionsWeCareAbout.forEach((p) => {
55
59
  bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
56
60
  });
@@ -116,6 +120,7 @@ async function getReportData() {
116
120
  });
117
121
  }
118
122
  const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
123
+ const native = isNativeAvailable();
119
124
  return {
120
125
  pm,
121
126
  pmVersion,
@@ -125,6 +130,7 @@ async function getReportData() {
125
130
  packageVersionsWeCareAbout,
126
131
  outOfSyncPackageGroup,
127
132
  projectGraphError,
133
+ nativeTarget: native ? native.getBinaryTarget() : null,
128
134
  };
129
135
  }
130
136
  async function tryGetProjectGraph() {
@@ -248,8 +254,7 @@ function findInstalledPackagesWeCareAbout() {
248
254
  }
249
255
  function isNativeAvailable() {
250
256
  try {
251
- require('../../native');
252
- return true;
257
+ return require('../../native');
253
258
  }
254
259
  catch {
255
260
  return false;
@@ -6,3 +6,9 @@ import type { Tree } from '../tree';
6
6
  export declare function formatChangedFilesWithPrettierIfAvailable(tree: Tree, options?: {
7
7
  silent?: boolean;
8
8
  }): Promise<void>;
9
+ export declare function formatFilesWithPrettierIfAvailable(files: {
10
+ path: string;
11
+ content: string | Buffer;
12
+ }[], root: string, options?: {
13
+ silent?: boolean;
14
+ }): Promise<Map<string, string>>;
@@ -1,23 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatChangedFilesWithPrettierIfAvailable = formatChangedFilesWithPrettierIfAvailable;
4
+ exports.formatFilesWithPrettierIfAvailable = formatFilesWithPrettierIfAvailable;
4
5
  const path = require("path");
5
6
  /**
6
7
  * Formats all the created or updated files using Prettier
7
8
  * @param tree - the file system tree
8
9
  */
9
10
  async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
11
+ const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE'));
12
+ const results = await formatFilesWithPrettierIfAvailable(Array.from(files), tree.root, options);
13
+ for (const [path, content] of results) {
14
+ tree.write(path, content);
15
+ }
16
+ }
17
+ async function formatFilesWithPrettierIfAvailable(files, root, options) {
18
+ const results = new Map();
10
19
  let prettier;
11
20
  try {
12
21
  prettier = await Promise.resolve().then(() => require('prettier'));
13
22
  }
14
23
  catch { }
15
- if (!prettier)
16
- return;
17
- const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE'));
24
+ if (!prettier) {
25
+ return results;
26
+ }
18
27
  await Promise.all(Array.from(files).map(async (file) => {
19
28
  try {
20
- const systemPath = path.join(tree.root, file.path);
29
+ const systemPath = path.join(root, file.path);
21
30
  let options = {
22
31
  filepath: systemPath,
23
32
  };
@@ -35,7 +44,7 @@ async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
35
44
  if (support.ignored || !support.inferredParser) {
36
45
  return;
37
46
  }
38
- tree.write(file.path,
47
+ results.set(file.path,
39
48
  // In prettier v3 the format result is a promise
40
49
  await prettier.format(file.content.toString('utf-8'), options));
41
50
  }
@@ -45,4 +54,5 @@ async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
45
54
  }
46
55
  }
47
56
  }));
57
+ return results;
48
58
  }
@@ -116,6 +116,8 @@ export interface FileSetInput {
116
116
 
117
117
  export declare export function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
118
118
 
119
+ export declare export function getBinaryTarget(): string
120
+
119
121
  /**
120
122
  * Expands the given outputs into a list of existing files.
121
123
  * This is used when hashing outputs
@@ -372,6 +372,7 @@ module.exports.copy = nativeBinding.copy
372
372
  module.exports.EventType = nativeBinding.EventType
373
373
  module.exports.expandOutputs = nativeBinding.expandOutputs
374
374
  module.exports.findImports = nativeBinding.findImports
375
+ module.exports.getBinaryTarget = nativeBinding.getBinaryTarget
375
376
  module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
376
377
  module.exports.hashArray = nativeBinding.hashArray
377
378
  module.exports.hashFile = nativeBinding.hashFile
@@ -88,39 +88,40 @@ function __napi_rs_initialize_modules(__napiInstance) {
88
88
  __napiInstance.exports['__napi_register__copy_3']?.()
89
89
  __napiInstance.exports['__napi_register__hash_array_4']?.()
90
90
  __napiInstance.exports['__napi_register__hash_file_5']?.()
91
- __napiInstance.exports['__napi_register__ImportResult_struct_6']?.()
92
- __napiInstance.exports['__napi_register__find_imports_7']?.()
93
- __napiInstance.exports['__napi_register__transfer_project_graph_8']?.()
94
- __napiInstance.exports['__napi_register__ExternalNode_struct_9']?.()
95
- __napiInstance.exports['__napi_register__Target_struct_10']?.()
96
- __napiInstance.exports['__napi_register__Project_struct_11']?.()
97
- __napiInstance.exports['__napi_register__ProjectGraph_struct_12']?.()
98
- __napiInstance.exports['__napi_register__HashPlanner_struct_13']?.()
99
- __napiInstance.exports['__napi_register__HashPlanner_impl_17']?.()
100
- __napiInstance.exports['__napi_register__HashDetails_struct_18']?.()
101
- __napiInstance.exports['__napi_register__HasherOptions_struct_19']?.()
102
- __napiInstance.exports['__napi_register__TaskHasher_struct_20']?.()
103
- __napiInstance.exports['__napi_register__TaskHasher_impl_23']?.()
104
- __napiInstance.exports['__napi_register__Task_struct_24']?.()
105
- __napiInstance.exports['__napi_register__TaskTarget_struct_25']?.()
106
- __napiInstance.exports['__napi_register__TaskGraph_struct_26']?.()
107
- __napiInstance.exports['__napi_register__FileData_struct_27']?.()
108
- __napiInstance.exports['__napi_register__InputsInput_struct_28']?.()
109
- __napiInstance.exports['__napi_register__FileSetInput_struct_29']?.()
110
- __napiInstance.exports['__napi_register__RuntimeInput_struct_30']?.()
111
- __napiInstance.exports['__napi_register__EnvironmentInput_struct_31']?.()
112
- __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_32']?.()
113
- __napiInstance.exports['__napi_register__DepsOutputsInput_struct_33']?.()
114
- __napiInstance.exports['__napi_register__NxJson_struct_34']?.()
115
- __napiInstance.exports['__napi_register__WorkspaceContext_struct_35']?.()
116
- __napiInstance.exports['__napi_register__WorkspaceContext_impl_44']?.()
117
- __napiInstance.exports['__napi_register__WorkspaceErrors_45']?.()
118
- __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_46']?.()
119
- __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_47']?.()
120
- __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_48']?.()
121
- __napiInstance.exports['__napi_register__FileMap_struct_49']?.()
122
- __napiInstance.exports['__napi_register____test_only_transfer_file_map_50']?.()
123
- __napiInstance.exports['__napi_register__IS_WASM_51']?.()
91
+ __napiInstance.exports['__napi_register__IS_WASM_6']?.()
92
+ __napiInstance.exports['__napi_register__get_binary_target_7']?.()
93
+ __napiInstance.exports['__napi_register__ImportResult_struct_8']?.()
94
+ __napiInstance.exports['__napi_register__find_imports_9']?.()
95
+ __napiInstance.exports['__napi_register__transfer_project_graph_10']?.()
96
+ __napiInstance.exports['__napi_register__ExternalNode_struct_11']?.()
97
+ __napiInstance.exports['__napi_register__Target_struct_12']?.()
98
+ __napiInstance.exports['__napi_register__Project_struct_13']?.()
99
+ __napiInstance.exports['__napi_register__ProjectGraph_struct_14']?.()
100
+ __napiInstance.exports['__napi_register__HashPlanner_struct_15']?.()
101
+ __napiInstance.exports['__napi_register__HashPlanner_impl_19']?.()
102
+ __napiInstance.exports['__napi_register__HashDetails_struct_20']?.()
103
+ __napiInstance.exports['__napi_register__HasherOptions_struct_21']?.()
104
+ __napiInstance.exports['__napi_register__TaskHasher_struct_22']?.()
105
+ __napiInstance.exports['__napi_register__TaskHasher_impl_25']?.()
106
+ __napiInstance.exports['__napi_register__Task_struct_26']?.()
107
+ __napiInstance.exports['__napi_register__TaskTarget_struct_27']?.()
108
+ __napiInstance.exports['__napi_register__TaskGraph_struct_28']?.()
109
+ __napiInstance.exports['__napi_register__FileData_struct_29']?.()
110
+ __napiInstance.exports['__napi_register__InputsInput_struct_30']?.()
111
+ __napiInstance.exports['__napi_register__FileSetInput_struct_31']?.()
112
+ __napiInstance.exports['__napi_register__RuntimeInput_struct_32']?.()
113
+ __napiInstance.exports['__napi_register__EnvironmentInput_struct_33']?.()
114
+ __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_34']?.()
115
+ __napiInstance.exports['__napi_register__DepsOutputsInput_struct_35']?.()
116
+ __napiInstance.exports['__napi_register__NxJson_struct_36']?.()
117
+ __napiInstance.exports['__napi_register__WorkspaceContext_struct_37']?.()
118
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_46']?.()
119
+ __napiInstance.exports['__napi_register__WorkspaceErrors_47']?.()
120
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_48']?.()
121
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_49']?.()
122
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_50']?.()
123
+ __napiInstance.exports['__napi_register__FileMap_struct_51']?.()
124
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_52']?.()
124
125
  }
125
126
  module.exports.HashPlanner = __napiModule.exports.HashPlanner
126
127
  module.exports.ImportResult = __napiModule.exports.ImportResult
@@ -129,6 +130,7 @@ module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
129
130
  module.exports.copy = __napiModule.exports.copy
130
131
  module.exports.expandOutputs = __napiModule.exports.expandOutputs
131
132
  module.exports.findImports = __napiModule.exports.findImports
133
+ module.exports.getBinaryTarget = __napiModule.exports.getBinaryTarget
132
134
  module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
133
135
  module.exports.hashArray = __napiModule.exports.hashArray
134
136
  module.exports.hashFile = __napiModule.exports.hashFile
Binary file
@@ -1,10 +1,11 @@
1
1
  import { Tree } from '../../../generators/tree';
2
- interface ConnectToNxCloudOptions {
2
+ export declare function printSuccessMessage(token: string | undefined, installationSource: string, usesGithub: boolean): Promise<string>;
3
+ export interface ConnectToNxCloudOptions {
3
4
  analytics?: boolean;
4
5
  installationSource?: string;
5
6
  hideFormatLogs?: boolean;
6
7
  github?: boolean;
7
8
  directory?: string;
8
9
  }
9
- export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<() => void>;
10
+ export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<string>;
10
11
  export default connectToNxCloud;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printSuccessMessage = printSuccessMessage;
3
4
  exports.connectToNxCloud = connectToNxCloud;
4
5
  const child_process_1 = require("child_process");
5
6
  const output_1 = require("../../../utils/output");
@@ -8,8 +9,6 @@ const nx_json_1 = require("../../../generators/utils/nx-json");
8
9
  const format_changed_files_with_prettier_if_available_1 = require("../../../generators/internal-utils/format-changed-files-with-prettier-if-available");
9
10
  const url_shorten_1 = require("../../utilities/url-shorten");
10
11
  const get_cloud_options_1 = require("../../utilities/get-cloud-options");
11
- const ora = require("ora");
12
- const open = require("open");
13
12
  function printCloudConnectionDisabledMessage() {
14
13
  output_1.output.error({
15
14
  title: `Connections to Nx Cloud are disabled for this workspace`,
@@ -55,53 +54,19 @@ async function createNxCloudWorkspace(workspaceName, installationSource, nxInitD
55
54
  return response.data;
56
55
  }
57
56
  async function printSuccessMessage(token, installationSource, usesGithub) {
58
- const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)(installationSource, token, usesGithub);
59
- if (installationSource === 'nx-connect' && usesGithub) {
60
- try {
61
- const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start();
62
- await sleep(2000);
63
- open(connectCloudUrl);
64
- cloudConnectSpinner.succeed();
65
- }
66
- catch (e) {
67
- output_1.output.note({
68
- title: `Your Nx Cloud workspace is ready.`,
69
- bodyLines: [
70
- `To claim it, connect it to your Nx Cloud account:`,
71
- `- Go to the following URL to connect your workspace to Nx Cloud:`,
72
- '',
73
- `${connectCloudUrl}`,
74
- ],
75
- });
76
- }
77
- }
78
- else {
79
- if (installationSource === 'create-nx-workspace') {
80
- output_1.output.note({
81
- title: `Your Nx Cloud workspace is ready.`,
82
- bodyLines: [
83
- `To claim it, connect it to your Nx Cloud account:`,
84
- `- Push your repository to your git hosting provider.`,
85
- `- Go to the following URL to connect your workspace to Nx Cloud:`,
86
- '',
87
- `${connectCloudUrl}`,
88
- ],
89
- });
90
- }
91
- else {
92
- output_1.output.note({
93
- title: `Your Nx Cloud workspace is ready.`,
94
- bodyLines: [
95
- `To claim it, connect it to your Nx Cloud account:`,
96
- `- Commit and push your changes.`,
97
- `- Create a pull request for the changes.`,
98
- `- Go to the following URL to connect your workspace to Nx Cloud:`,
99
- '',
100
- `${connectCloudUrl}`,
101
- ],
102
- });
103
- }
104
- }
57
+ const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, usesGithub);
58
+ output_1.output.note({
59
+ title: `Your Nx Cloud workspace is ready.`,
60
+ bodyLines: [
61
+ `To claim it, connect it to your Nx Cloud account:`,
62
+ `- Commit and push your changes.`,
63
+ `- Create a pull request for the changes.`,
64
+ `- Go to the following URL to connect your workspace to Nx Cloud:`,
65
+ '',
66
+ `${connectCloudUrl}`,
67
+ ],
68
+ });
69
+ return connectCloudUrl;
105
70
  }
106
71
  function addNxCloudOptionsToNxJson(tree, nxJson, token) {
107
72
  nxJson ??= {
@@ -118,12 +83,11 @@ async function connectToNxCloud(tree, schema) {
118
83
  schema.installationSource ??= 'user';
119
84
  const nxJson = (0, nx_json_1.readNxJson)(tree);
120
85
  if (nxJson?.neverConnectToCloud) {
121
- return () => {
122
- printCloudConnectionDisabledMessage();
123
- };
86
+ printCloudConnectionDisabledMessage();
87
+ return null;
124
88
  }
125
89
  else {
126
- const usesGithub = await (0, url_shorten_1.repoUsesGithub)(schema.github);
90
+ const usesGithub = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
127
91
  let responseFromCreateNxCloudWorkspace;
128
92
  // do NOT create Nx Cloud token (createNxCloudWorkspace)
129
93
  // if user is using github and is running nx-connect
@@ -133,11 +97,8 @@ async function connectToNxCloud(tree, schema) {
133
97
  await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
134
98
  silent: schema.hideFormatLogs,
135
99
  });
100
+ return responseFromCreateNxCloudWorkspace.token;
136
101
  }
137
- return async () => await printSuccessMessage(responseFromCreateNxCloudWorkspace?.token, schema.installationSource, usesGithub);
138
102
  }
139
103
  }
140
- function sleep(ms) {
141
- return new Promise((resolve) => setTimeout(resolve, ms));
142
- }
143
104
  exports.default = connectToNxCloud;
@@ -1,4 +1,4 @@
1
- export declare function shortenedCloudUrl(installationSource: string, accessToken?: string, usesGithub?: boolean): Promise<string>;
1
+ export declare function createNxCloudOnboardingURL(onboardingSource: string, accessToken?: string, usesGithub?: boolean, meta?: string): Promise<string>;
2
2
  export declare function repoUsesGithub(github?: boolean, githubSlug?: string, apiUrl?: string): Promise<boolean>;
3
3
  export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string | null, apiUrl: string, source: string, accessToken?: string): string;
4
4
  export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shortenedCloudUrl = shortenedCloudUrl;
3
+ exports.createNxCloudOnboardingURL = createNxCloudOnboardingURL;
4
4
  exports.repoUsesGithub = repoUsesGithub;
5
5
  exports.getURLifShortenFailed = getURLifShortenFailed;
6
6
  exports.getNxCloudVersion = getNxCloudVersion;
@@ -10,7 +10,7 @@ exports.compareCleanCloudVersions = compareCleanCloudVersions;
10
10
  const devkit_exports_1 = require("../../devkit-exports");
11
11
  const git_utils_1 = require("../../utils/git-utils");
12
12
  const get_cloud_options_1 = require("./get-cloud-options");
13
- async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
13
+ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGithub, meta) {
14
14
  const githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
15
15
  const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
16
16
  if (usesGithub === undefined || usesGithub === null) {
@@ -28,13 +28,14 @@ async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
28
28
  ${e}`);
29
29
  return apiUrl;
30
30
  }
31
- const source = getSource(installationSource);
31
+ const source = getSource(onboardingSource);
32
32
  try {
33
33
  const response = await require('axios').post(`${apiUrl}/nx-cloud/onboarding`, {
34
34
  type: usesGithub ? 'GITHUB' : 'MANUAL',
35
35
  source,
36
36
  accessToken: usesGithub ? null : accessToken,
37
37
  selectedRepositoryName: githubSlug === 'github' ? null : githubSlug,
38
+ meta,
38
39
  });
39
40
  if (!response?.data || response.data.message) {
40
41
  throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
@@ -67,11 +68,8 @@ function getSource(installationSource) {
67
68
  else if (installationSource.includes('nx-connect')) {
68
69
  return 'nx-connect';
69
70
  }
70
- else if (installationSource.includes('create-nx-workspace')) {
71
- return 'create-nx-workspace';
72
- }
73
71
  else {
74
- return 'other';
72
+ return installationSource;
75
73
  }
76
74
  }
77
75
  function getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessToken) {
@@ -13,6 +13,7 @@ const loader_1 = require("./loader");
13
13
  const utils_1 = require("./utils");
14
14
  const error_types_1 = require("../error-types");
15
15
  const native_1 = require("../../native");
16
+ const os_1 = require("os");
16
17
  class LoadedNxPlugin {
17
18
  constructor(plugin, pluginDefinition) {
18
19
  this.name = plugin.name;
@@ -74,7 +75,9 @@ exports.nxPluginCache = new Map();
74
75
  async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
75
76
  performance.mark('loadNxPlugins:start');
76
77
  const loadingMethod = process.env.NX_ISOLATE_PLUGINS === 'true' ||
77
- (!native_1.IS_WASM && process.env.NX_ISOLATE_PLUGINS !== 'false')
78
+ (!native_1.IS_WASM &&
79
+ (0, os_1.platform)() !== 'win32' &&
80
+ process.env.NX_ISOLATE_PLUGINS !== 'false')
78
81
  ? isolation_1.loadNxPluginInIsolation
79
82
  : loader_1.loadNxPlugin;
80
83
  plugins = await normalizePlugins(plugins, root);
@@ -8,6 +8,7 @@ exports.unloadDotEnvFile = unloadDotEnvFile;
8
8
  const dotenv_1 = require("dotenv");
9
9
  const dotenv_expand_1 = require("dotenv-expand");
10
10
  const workspace_root_1 = require("../utils/workspace-root");
11
+ const node_path_1 = require("node:path");
11
12
  function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
12
13
  return {
13
14
  // User Process Env Variables override Dotenv Variables
@@ -158,13 +159,13 @@ function getEnvFilesForTask(task) {
158
159
  function loadDotEnvFilesForTask(task, environmentVariables) {
159
160
  const dotEnvFiles = getEnvFilesForTask(task);
160
161
  for (const file of dotEnvFiles) {
161
- loadAndExpandDotEnvFile(file, environmentVariables);
162
+ loadAndExpandDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables);
162
163
  }
163
164
  return environmentVariables;
164
165
  }
165
166
  function unloadDotEnvFiles(environmentVariables) {
166
167
  for (const file of ['.env', '.local.env', '.env.local']) {
167
- unloadDotEnvFile(file, environmentVariables);
168
+ unloadDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables);
168
169
  }
169
170
  return environmentVariables;
170
171
  }
@@ -66,7 +66,7 @@ function validateNoAtomizedTasks(taskGraph, projectGraph) {
66
66
  .filter((item, index, arr) => arr.indexOf(item) === index);
67
67
  const moreInfoLines = [
68
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',
69
+ 'Learn more at https://nx.dev/ci/features/split-e2e-tasks#nx-cloud-is-required-to-run-atomized-tasks',
70
70
  ];
71
71
  if (atomizedRootTasks.length === 1) {
72
72
  output_1.output.error({