nx 20.0.0-canary.20241002-1d10a19 → 20.0.0-canary.20241005-75c1da3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/.eslintrc.json +12 -2
  2. package/bin/init-local.js +0 -39
  3. package/bin/nx.js +3 -13
  4. package/migrations.json +5 -37
  5. package/package.json +11 -11
  6. package/release/changelog-renderer/index.d.ts +60 -38
  7. package/release/changelog-renderer/index.js +260 -236
  8. package/src/adapter/compat.d.ts +1 -1
  9. package/src/adapter/compat.js +1 -1
  10. package/src/command-line/add/add.js +2 -2
  11. package/src/command-line/affected/affected.js +0 -2
  12. package/src/command-line/nx-commands.js +31 -10
  13. package/src/command-line/release/changelog.d.ts +2 -2
  14. package/src/command-line/release/changelog.js +28 -29
  15. package/src/command-line/release/index.d.ts +5 -2
  16. package/src/command-line/release/publish.d.ts +6 -1
  17. package/src/command-line/release/publish.js +31 -25
  18. package/src/command-line/release/utils/git.js +2 -2
  19. package/src/command-line/release/utils/print-changes.js +6 -4
  20. package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
  21. package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
  22. package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
  23. package/src/command-line/release/version.d.ts +3 -3
  24. package/src/command-line/run/run-one.js +0 -2
  25. package/src/command-line/run/run.js +0 -1
  26. package/src/command-line/run-many/run-many.js +1 -4
  27. package/src/command-line/yargs-utils/shared-options.js +2 -2
  28. package/src/config/misc-interfaces.d.ts +3 -15
  29. package/src/config/nx-json.d.ts +4 -3
  30. package/src/config/project-graph.d.ts +0 -2
  31. package/src/core/graph/main.js +1 -1
  32. package/src/daemon/client/client.js +1 -3
  33. package/src/devkit-exports.d.ts +3 -4
  34. package/src/devkit-exports.js +3 -6
  35. package/src/executors/utils/convert-nx-executor.js +0 -1
  36. package/src/generators/utils/nx-json.d.ts +1 -1
  37. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  38. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  39. package/src/native/nx.wasm32-wasi.wasm +0 -0
  40. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +54 -6
  41. package/src/nx-cloud/utilities/axios.js +1 -2
  42. package/src/nx-cloud/utilities/onboarding.js +2 -2
  43. package/src/nx-cloud/utilities/url-shorten.js +5 -5
  44. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
  45. package/src/project-graph/build-project-graph.js +3 -41
  46. package/src/project-graph/error-types.d.ts +4 -10
  47. package/src/project-graph/error-types.js +1 -12
  48. package/src/project-graph/file-utils.d.ts +2 -2
  49. package/src/project-graph/file-utils.js +3 -3
  50. package/src/project-graph/nx-deps-cache.d.ts +0 -1
  51. package/src/project-graph/nx-deps-cache.js +0 -1
  52. package/src/project-graph/plugins/internal-api.d.ts +2 -5
  53. package/src/project-graph/plugins/internal-api.js +0 -1
  54. package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
  55. package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
  56. package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
  57. package/src/project-graph/plugins/loader.js +2 -3
  58. package/src/project-graph/plugins/public-api.d.ts +6 -7
  59. package/src/project-graph/plugins/utils.d.ts +1 -7
  60. package/src/project-graph/plugins/utils.js +0 -37
  61. package/src/project-graph/utils/project-configuration-utils.js +1 -1
  62. package/src/tasks-runner/batch/run-batch.js +0 -1
  63. package/src/tasks-runner/cache.d.ts +2 -1
  64. package/src/tasks-runner/cache.js +11 -6
  65. package/src/tasks-runner/create-task-graph.d.ts +2 -0
  66. package/src/tasks-runner/create-task-graph.js +39 -5
  67. package/src/tasks-runner/init-tasks-runner.js +0 -2
  68. package/src/tasks-runner/run-command.js +15 -2
  69. package/src/tasks-runner/task-orchestrator.js +1 -1
  70. package/src/utils/command-line-utils.d.ts +3 -0
  71. package/src/utils/command-line-utils.js +24 -33
  72. package/src/utils/git-utils.js +2 -2
  73. package/src/utils/plugins/plugin-capabilities.js +2 -3
  74. package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
  75. package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
  76. package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
  77. package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
  78. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
  79. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
  80. package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
  81. package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
  82. package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
  83. package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
  84. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
  85. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
  86. package/src/utils/app-root.d.ts +0 -8
  87. package/src/utils/app-root.js +0 -12
  88. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  89. package/src/utils/nx-plugin.deprecated.js +0 -20
  90. package/src/utils/workspace-configuration-check.d.ts +0 -1
  91. package/src/utils/workspace-configuration-check.js +0 -36
@@ -29,6 +29,7 @@ const command_object_23 = require("./login/command-object");
29
29
  const command_object_24 = require("./logout/command-object");
30
30
  const command_objects_1 = require("./deprecated/command-objects");
31
31
  const command_object_25 = require("./sync/command-object");
32
+ const output_1 = require("../utils/output");
32
33
  // Ensure that the output takes up the available width of the terminal.
33
34
  yargs.wrap(yargs.terminalWidth());
34
35
  exports.parserConfiguration = {
@@ -82,26 +83,46 @@ exports.commandsObject = yargs
82
83
  .command(command_object_23.yargsLoginCommand)
83
84
  .command(command_object_24.yargsLogoutCommand)
84
85
  .command(resolveConformanceCommandObject())
86
+ .command(resolveConformanceCheckCommandObject())
85
87
  .scriptName('nx')
86
88
  .help()
87
89
  // NOTE: we handle --version in nx.ts, this just tells yargs that the option exists
88
90
  // so that it shows up in help. The default yargs implementation of --version is not
89
91
  // hit, as the implementation in nx.ts is hit first and calls process.exit(0).
90
92
  .version();
93
+ function createMissingConformanceCommand(command) {
94
+ return {
95
+ command,
96
+ // Hide from --help output in the common case of not having the plugin installed
97
+ describe: false,
98
+ handler: () => {
99
+ output_1.output.error({
100
+ title: `${command} is not available`,
101
+ bodyLines: [
102
+ `In order to use the \`nx ${command}\` command you must have an active Powerpack license and the \`@nx/powerpack-conformance\` plugin installed.`,
103
+ '',
104
+ 'To learn more, visit https://nx.dev/features/powerpack/conformance',
105
+ ],
106
+ });
107
+ process.exit(1);
108
+ },
109
+ };
110
+ }
91
111
  function resolveConformanceCommandObject() {
92
112
  try {
93
113
  const { yargsConformanceCommand } = require('@nx/powerpack-conformance');
94
114
  return yargsConformanceCommand;
95
115
  }
96
- catch (e) {
97
- return {
98
- command: 'conformance',
99
- // Hide from --help output in the common case of not having the plugin installed
100
- describe: false,
101
- handler: () => {
102
- // TODO: Add messaging to help with learning more about powerpack and conformance
103
- process.exit(1);
104
- },
105
- };
116
+ catch {
117
+ return createMissingConformanceCommand('conformance');
118
+ }
119
+ }
120
+ function resolveConformanceCheckCommandObject() {
121
+ try {
122
+ const { yargsConformanceCheckCommand, } = require('@nx/powerpack-conformance');
123
+ return yargsConformanceCheckCommand;
124
+ }
125
+ catch {
126
+ return createMissingConformanceCommand('conformance:check');
106
127
  }
107
128
  }
@@ -22,10 +22,10 @@ export interface ChangelogChange {
22
22
  body?: string;
23
23
  isBreaking?: boolean;
24
24
  githubReferences?: Reference[];
25
- author?: {
25
+ authors?: {
26
26
  name: string;
27
27
  email: string;
28
- };
28
+ }[];
29
29
  shortHash?: string;
30
30
  revertedHashes?: string[];
31
31
  }
@@ -162,7 +162,8 @@ function createAPI(overrideReleaseConfig) {
162
162
  body: '',
163
163
  isBreaking: releaseType.isBreaking,
164
164
  githubReferences,
165
- author,
165
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
166
+ authors: [author],
166
167
  affectedProjects: '*',
167
168
  }
168
169
  : vp.triggeredByProjects.map((project) => {
@@ -173,7 +174,8 @@ function createAPI(overrideReleaseConfig) {
173
174
  body: '',
174
175
  isBreaking: releaseType.isBreaking,
175
176
  githubReferences,
176
- author,
177
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
178
+ authors: [author],
177
179
  affectedProjects: [project],
178
180
  };
179
181
  });
@@ -209,7 +211,7 @@ function createAPI(overrideReleaseConfig) {
209
211
  body: c.body,
210
212
  isBreaking: c.isBreaking,
211
213
  githubReferences: c.references,
212
- author: c.author,
214
+ authors: [c.author],
213
215
  shortHash: c.shortHash,
214
216
  revertedHashes: c.revertedHashes,
215
217
  affectedProjects: '*',
@@ -313,13 +315,14 @@ function createAPI(overrideReleaseConfig) {
313
315
  }
314
316
  const releaseType = versionPlanSemverReleaseTypeToChangelogType(bumpForProject);
315
317
  let githubReferences = [];
316
- let author = undefined;
318
+ let authors = [];
317
319
  const parsedCommit = vp.commit
318
320
  ? (0, git_1.parseGitCommit)(vp.commit, true)
319
321
  : null;
320
322
  if (parsedCommit) {
321
323
  githubReferences = parsedCommit.references;
322
- author = parsedCommit.author;
324
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
325
+ authors = [parsedCommit.author];
323
326
  }
324
327
  return {
325
328
  type: releaseType.type,
@@ -329,7 +332,7 @@ function createAPI(overrideReleaseConfig) {
329
332
  isBreaking: releaseType.isBreaking,
330
333
  affectedProjects: Object.keys(vp.projectVersionBumps),
331
334
  githubReferences,
332
- author,
335
+ authors,
333
336
  };
334
337
  })
335
338
  .filter(Boolean);
@@ -365,7 +368,8 @@ function createAPI(overrideReleaseConfig) {
365
368
  body: c.body,
366
369
  isBreaking: c.isBreaking,
367
370
  githubReferences: c.references,
368
- author: c.author,
371
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
372
+ authors: [c.author],
369
373
  shortHash: c.shortHash,
370
374
  revertedHashes: c.revertedHashes,
371
375
  affectedProjects: commitChangesNonProjectFiles(c, fileMap.nonProjectFiles)
@@ -376,15 +380,12 @@ function createAPI(overrideReleaseConfig) {
376
380
  const projectChangelogs = await generateChangelogForProjects({
377
381
  tree,
378
382
  args,
379
- projectGraph,
380
383
  changes,
381
384
  projectsVersionData,
382
385
  releaseGroup,
383
386
  projects: [project],
384
387
  nxReleaseConfig,
385
388
  projectToAdditionalDependencyBumps,
386
- // TODO: remove this after the changelog renderer is refactored to remove coupling with git commits
387
- commits: filterHiddenCommits(commits, nxReleaseConfig.conventionalCommits),
388
389
  });
389
390
  let hasPushed = false;
390
391
  for (const [projectName, projectChangelog] of Object.entries(projectChangelogs)) {
@@ -436,7 +437,8 @@ function createAPI(overrideReleaseConfig) {
436
437
  body: '',
437
438
  isBreaking: releaseType.isBreaking,
438
439
  githubReferences,
439
- author,
440
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
441
+ authors: [author],
440
442
  affectedProjects: '*',
441
443
  }
442
444
  : vp.triggeredByProjects.map((project) => {
@@ -447,7 +449,8 @@ function createAPI(overrideReleaseConfig) {
447
449
  body: '',
448
450
  isBreaking: releaseType.isBreaking,
449
451
  githubReferences,
450
- author,
452
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
453
+ authors: [author],
451
454
  affectedProjects: [project],
452
455
  };
453
456
  });
@@ -482,7 +485,8 @@ function createAPI(overrideReleaseConfig) {
482
485
  body: c.body,
483
486
  isBreaking: c.isBreaking,
484
487
  githubReferences: c.references,
485
- author: c.author,
488
+ // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
489
+ authors: [c.author],
486
490
  shortHash: c.shortHash,
487
491
  revertedHashes: c.revertedHashes,
488
492
  affectedProjects: commitChangesNonProjectFiles(c, fileMap.nonProjectFiles)
@@ -493,15 +497,12 @@ function createAPI(overrideReleaseConfig) {
493
497
  const projectChangelogs = await generateChangelogForProjects({
494
498
  tree,
495
499
  args,
496
- projectGraph,
497
500
  changes,
498
501
  projectsVersionData,
499
502
  releaseGroup,
500
503
  projects: projectNodes,
501
504
  nxReleaseConfig,
502
505
  projectToAdditionalDependencyBumps,
503
- // TODO: remove this after the changelog renderer is refactored to remove coupling with git commits
504
- commits: filterHiddenCommits(commits, nxReleaseConfig.conventionalCommits),
505
506
  });
506
507
  let hasPushed = false;
507
508
  for (const [projectName, projectChangelog] of Object.entries(projectChangelogs)) {
@@ -716,7 +717,7 @@ async function generateChangelogForWorkspace({ tree, args, projectGraph, nxRelea
716
717
  const interactive = args.interactive === 'all' || args.interactive === 'workspace';
717
718
  const dryRun = !!args.dryRun;
718
719
  const gitRemote = args.gitRemote;
719
- const changelogRenderer = (0, resolve_changelog_renderer_1.resolveChangelogRenderer)(config.renderer);
720
+ const ChangelogRendererClass = (0, resolve_changelog_renderer_1.resolveChangelogRenderer)(config.renderer);
720
721
  let interpolatedTreePath = config.file || '';
721
722
  if (interpolatedTreePath) {
722
723
  interpolatedTreePath = (0, utils_1.interpolate)(interpolatedTreePath, {
@@ -736,18 +737,17 @@ async function generateChangelogForWorkspace({ tree, args, projectGraph, nxRelea
736
737
  });
737
738
  }
738
739
  const githubRepoData = (0, github_1.getGitHubRepoData)(gitRemote, config.createRelease);
739
- let contents = await changelogRenderer({
740
- projectGraph,
740
+ const changelogRenderer = new ChangelogRendererClass({
741
741
  changes,
742
- commits,
743
- releaseVersion: releaseVersion.rawVersion,
742
+ changelogEntryVersion: releaseVersion.rawVersion,
744
743
  project: null,
745
- repoSlug: githubRepoData?.slug,
744
+ isVersionPlans: false,
746
745
  repoData: githubRepoData,
747
746
  entryWhenNoChanges: config.entryWhenNoChanges,
748
747
  changelogRenderOptions: config.renderOptions,
749
748
  conventionalCommitsConfig: nxReleaseConfig.conventionalCommits,
750
749
  });
750
+ let contents = await changelogRenderer.render();
751
751
  /**
752
752
  * If interactive mode, make the changelog contents available for the user to modify in their editor of choice,
753
753
  * in a similar style to git interactive rebases/merges.
@@ -789,7 +789,7 @@ async function generateChangelogForWorkspace({ tree, args, projectGraph, nxRelea
789
789
  contents,
790
790
  };
791
791
  }
792
- async function generateChangelogForProjects({ tree, args, projectGraph, changes, commits, projectsVersionData, releaseGroup, projects, nxReleaseConfig, projectToAdditionalDependencyBumps, }) {
792
+ async function generateChangelogForProjects({ tree, args, changes, projectsVersionData, releaseGroup, projects, nxReleaseConfig, projectToAdditionalDependencyBumps, }) {
793
793
  const config = releaseGroup.changelog;
794
794
  // The entire feature is disabled at the release group level, exit early
795
795
  if (config === false) {
@@ -799,7 +799,7 @@ async function generateChangelogForProjects({ tree, args, projectGraph, changes,
799
799
  const interactive = args.interactive === 'all' || args.interactive === 'projects';
800
800
  const dryRun = !!args.dryRun;
801
801
  const gitRemote = args.gitRemote;
802
- const changelogRenderer = (0, resolve_changelog_renderer_1.resolveChangelogRenderer)(config.renderer);
802
+ const ChangelogRendererClass = (0, resolve_changelog_renderer_1.resolveChangelogRenderer)(config.renderer);
803
803
  const projectChangelogs = {};
804
804
  for (const project of projects) {
805
805
  let interpolatedTreePath = config.file || '';
@@ -829,13 +829,10 @@ async function generateChangelogForProjects({ tree, args, projectGraph, changes,
829
829
  });
830
830
  }
831
831
  const githubRepoData = (0, github_1.getGitHubRepoData)(gitRemote, config.createRelease);
832
- let contents = await changelogRenderer({
833
- projectGraph,
832
+ const changelogRenderer = new ChangelogRendererClass({
834
833
  changes,
835
- commits,
836
- releaseVersion: releaseVersion.rawVersion,
834
+ changelogEntryVersion: releaseVersion.rawVersion,
837
835
  project: project.name,
838
- repoSlug: githubRepoData?.slug,
839
836
  repoData: githubRepoData,
840
837
  entryWhenNoChanges: typeof config.entryWhenNoChanges === 'string'
841
838
  ? (0, utils_1.interpolate)(config.entryWhenNoChanges, {
@@ -845,11 +842,13 @@ async function generateChangelogForProjects({ tree, args, projectGraph, changes,
845
842
  })
846
843
  : false,
847
844
  changelogRenderOptions: config.renderOptions,
845
+ isVersionPlans: !!releaseGroup.versionPlans,
848
846
  conventionalCommitsConfig: releaseGroup.versionPlans
849
847
  ? null
850
848
  : nxReleaseConfig.conventionalCommits,
851
849
  dependencyBumps: projectToAdditionalDependencyBumps.get(project.name),
852
850
  });
851
+ let contents = await changelogRenderer.render();
853
852
  /**
854
853
  * If interactive mode, make the changelog contents available for the user to modify in their editor of choice,
855
854
  * in a similar style to git interactive rebases/merges.
@@ -5,7 +5,7 @@ import type { NxReleaseConfiguration } from '../../config/nx-json';
5
5
  export declare class ReleaseClient {
6
6
  private overrideReleaseConfig;
7
7
  releaseChangelog: (args: import("./command-object").ChangelogOptions) => Promise<import("./changelog").NxReleaseChangelogResult>;
8
- releasePublish: (args: import("./command-object").PublishOptions, isCLI?: boolean) => Promise<number>;
8
+ releasePublish: (args: import("./command-object").PublishOptions) => Promise<import("./publish").PublishProjectsResult>;
9
9
  releaseVersion: (args: import("./command-object").VersionOptions) => Promise<import("./version").NxReleaseVersionResult>;
10
10
  release: (args: import("./command-object").ReleaseOptions) => Promise<import("./version").NxReleaseVersionResult | number>;
11
11
  constructor(overrideReleaseConfig: NxReleaseConfiguration);
@@ -15,6 +15,10 @@ declare const defaultClient: ReleaseClient;
15
15
  * @public
16
16
  */
17
17
  export declare const releaseChangelog: typeof defaultClient.releaseChangelog;
18
+ /**
19
+ * @public
20
+ */
21
+ export { PublishProjectsResult } from './publish';
18
22
  /**
19
23
  * @public
20
24
  */
@@ -27,4 +31,3 @@ export declare const releaseVersion: typeof defaultClient.releaseVersion;
27
31
  * @public
28
32
  */
29
33
  export declare const release: typeof defaultClient.release;
30
- export {};
@@ -1,4 +1,9 @@
1
1
  import { NxReleaseConfiguration } from '../../config/nx-json';
2
2
  import { PublishOptions } from './command-object';
3
+ export interface PublishProjectsResult {
4
+ [projectName: string]: {
5
+ code: number;
6
+ };
7
+ }
3
8
  export declare const releasePublishCLIHandler: (args: PublishOptions) => Promise<number>;
4
- export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration): (args: PublishOptions, isCLI?: boolean) => Promise<number>;
9
+ export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration): (args: PublishOptions) => Promise<PublishProjectsResult>;
@@ -7,15 +7,21 @@ const file_map_utils_1 = require("../../project-graph/file-map-utils");
7
7
  const project_graph_1 = require("../../project-graph/project-graph");
8
8
  const run_command_1 = require("../../tasks-runner/run-command");
9
9
  const command_line_utils_1 = require("../../utils/command-line-utils");
10
- const output_1 = require("../../utils/output");
11
10
  const handle_errors_1 = require("../../utils/handle-errors");
11
+ const output_1 = require("../../utils/output");
12
12
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
13
13
  const graph_1 = require("../graph/graph");
14
14
  const config_1 = require("./config/config");
15
15
  const deep_merge_json_1 = require("./config/deep-merge-json");
16
16
  const filter_release_groups_1 = require("./config/filter-release-groups");
17
17
  const print_config_1 = require("./utils/print-config");
18
- const releasePublishCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args, true));
18
+ const releasePublishCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, async () => {
19
+ const publishProjectsResult = await createAPI({})(args);
20
+ // If all projects are published successfully, return 0, otherwise return 1
21
+ return Object.values(publishProjectsResult).every((result) => result.code === 0)
22
+ ? 0
23
+ : 1;
24
+ });
19
25
  exports.releasePublishCLIHandler = releasePublishCLIHandler;
20
26
  function createAPI(overrideReleaseConfig) {
21
27
  /**
@@ -23,7 +29,7 @@ function createAPI(overrideReleaseConfig) {
23
29
  * of Nx. We intentionally do not wrap the implementation with handleErrors because users need
24
30
  * to have control over their own error handling when using the API.
25
31
  */
26
- return async function releasePublish(args, isCLI = false) {
32
+ return async function releasePublish(args) {
27
33
  /**
28
34
  * When used via the CLI, the args object will contain a __overrides_unparsed__ property that is
29
35
  * important for invoking the relevant executor behind the scenes.
@@ -60,38 +66,40 @@ function createAPI(overrideReleaseConfig) {
60
66
  const shouldExcludeTaskDependencies = _args.projects?.length > 0 ||
61
67
  _args.groups?.length > 0 ||
62
68
  args.excludeTaskDependencies;
63
- let overallExitStatus = 0;
69
+ let overallPublishProjectsResult = {};
64
70
  if (args.projects?.length) {
65
71
  /**
66
72
  * Run publishing for all remaining release groups and filtered projects within them
67
73
  */
68
74
  for (const releaseGroup of releaseGroups) {
69
- const status = await runPublishOnProjects(_args, projectGraph, nxJson, Array.from(releaseGroupToFilteredProjects.get(releaseGroup)), isCLI, {
75
+ const publishProjectsResult = await runPublishOnProjects(_args, projectGraph, nxJson, Array.from(releaseGroupToFilteredProjects.get(releaseGroup)), {
70
76
  excludeTaskDependencies: shouldExcludeTaskDependencies,
71
77
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
72
78
  });
73
- if (status !== 0) {
74
- overallExitStatus = status || 1;
75
- }
79
+ overallPublishProjectsResult = {
80
+ ...overallPublishProjectsResult,
81
+ ...publishProjectsResult,
82
+ };
76
83
  }
77
- return overallExitStatus;
84
+ return overallPublishProjectsResult;
78
85
  }
79
86
  /**
80
87
  * Run publishing for all remaining release groups
81
88
  */
82
89
  for (const releaseGroup of releaseGroups) {
83
- const status = await runPublishOnProjects(_args, projectGraph, nxJson, releaseGroup.projects, isCLI, {
90
+ const publishProjectsResult = await runPublishOnProjects(_args, projectGraph, nxJson, releaseGroup.projects, {
84
91
  excludeTaskDependencies: shouldExcludeTaskDependencies,
85
92
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
86
93
  });
87
- if (status !== 0) {
88
- overallExitStatus = status || 1;
89
- }
94
+ overallPublishProjectsResult = {
95
+ ...overallPublishProjectsResult,
96
+ ...publishProjectsResult,
97
+ };
90
98
  }
91
- return overallExitStatus;
99
+ return overallPublishProjectsResult;
92
100
  };
93
101
  }
94
- async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, isCLI, extraOptions) {
102
+ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, extraOptions) {
95
103
  const projectsToRun = projectNames.map((projectName) => projectGraph.nodes[projectName]);
96
104
  const overrides = (0, command_line_utils_1.createOverrides)(args.__overrides_unparsed__);
97
105
  if (args.registry) {
@@ -132,7 +140,7 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, is
132
140
  projects: projectNamesWithTarget,
133
141
  file,
134
142
  }, projectNamesWithTarget);
135
- return 0;
143
+ return {};
136
144
  }
137
145
  const projectsWithTarget = projectsToRun.filter((project) => (0, project_graph_utils_1.projectHasTarget)(project, requiredTargetName));
138
146
  if (projectsWithTarget.length === 0) {
@@ -145,20 +153,18 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, is
145
153
  /**
146
154
  * Run the relevant nx-release-publish executor on each of the selected projects.
147
155
  */
148
- const status = await (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, { nxJson }, {
156
+ const commandResults = await (0, run_command_1.runCommandForTasks)(projectsWithTarget, projectGraph, { nxJson }, {
149
157
  targets: [requiredTargetName],
150
158
  outputStyle: 'static',
151
159
  ...args,
152
160
  // It is possible for workspaces to have circular dependencies between packages and still release them to a registry
153
161
  nxIgnoreCycles: true,
154
162
  }, overrides, null, {}, extraOptions);
155
- if (status !== 0) {
156
- // In order to not add noise to the overall CLI output, do not throw an additional error
157
- if (isCLI) {
158
- return status;
159
- }
160
- // Throw an additional error for programmatic API usage
161
- throw new Error('One or more of the selected projects could not be published');
163
+ const publishProjectsResult = {};
164
+ for (const taskData of Object.values(commandResults)) {
165
+ publishProjectsResult[taskData.task.target.project] = {
166
+ code: taskData.code,
167
+ };
162
168
  }
163
- return 0;
169
+ return publishProjectsResult;
164
170
  }
@@ -16,7 +16,7 @@ exports.getFirstGitCommit = getFirstGitCommit;
16
16
  * https://github.com/unjs/changelogen
17
17
  */
18
18
  const utils_1 = require("../../../tasks-runner/utils");
19
- const app_root_1 = require("../../../utils/app-root");
19
+ const workspace_root_1 = require("../../../utils/workspace-root");
20
20
  const exec_command_1 = require("./exec-command");
21
21
  function escapeRegExp(string) {
22
22
  return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
@@ -118,7 +118,7 @@ async function getChangedTrackedFiles(cwd) {
118
118
  async function gitAdd({ changedFiles, deletedFiles, dryRun, verbose, logFn, cwd, }) {
119
119
  logFn = logFn || console.log;
120
120
  // Default to running git add related commands from the workspace root
121
- cwd = cwd || app_root_1.workspaceRoot;
121
+ cwd = cwd || workspace_root_1.workspaceRoot;
122
122
  let ignoredFiles = [];
123
123
  let filesToAdd = [];
124
124
  for (const f of changedFiles ?? []) {
@@ -5,8 +5,10 @@ exports.printAndFlushChanges = printAndFlushChanges;
5
5
  const chalk = require("chalk");
6
6
  const jest_diff_1 = require("jest-diff");
7
7
  const node_fs_1 = require("node:fs");
8
- const devkit_exports_1 = require("../../../devkit-exports");
9
8
  const tree_1 = require("../../../generators/tree");
9
+ const workspace_root_1 = require("../../../utils/workspace-root");
10
+ const path_1 = require("../../../utils/path");
11
+ const logger_1 = require("../../../utils/logger");
10
12
  // jest-diff does not export this constant
11
13
  const NO_DIFF_MESSAGE = 'Compared values have no visual difference.';
12
14
  function printDiff(before, after, contextLines = 1, noDiffMessage = NO_DIFF_MESSAGE) {
@@ -43,7 +45,7 @@ function printAndFlushChanges(tree, isDryRun, diffContextLines = 1, shouldPrintD
43
45
  }
44
46
  else if (f.type === 'UPDATE') {
45
47
  console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
46
- const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, devkit_exports_1.joinPathFragments)(tree.root, f.path)).toString();
48
+ const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
47
49
  printDiff(currentContentsOnDisk, f.content?.toString() || '', diffContextLines, noDiffMessage);
48
50
  }
49
51
  else if (f.type === 'DELETE') {
@@ -51,9 +53,9 @@ function printAndFlushChanges(tree, isDryRun, diffContextLines = 1, shouldPrintD
51
53
  }
52
54
  });
53
55
  if (!isDryRun) {
54
- (0, tree_1.flushChanges)(devkit_exports_1.workspaceRoot, changes);
56
+ (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
55
57
  }
56
58
  if (isDryRun && shouldPrintDryRunMessage) {
57
- devkit_exports_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
59
+ logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
58
60
  }
59
61
  }
@@ -1,2 +1,2 @@
1
- import type { ChangelogRenderer } from '../../../../release/changelog-renderer';
2
- export declare function resolveChangelogRenderer(changelogRendererPath: string): ChangelogRenderer;
1
+ import type ChangelogRenderer from '../../../../release/changelog-renderer';
2
+ export declare function resolveChangelogRenderer(changelogRendererPath: string): typeof ChangelogRenderer;
@@ -10,7 +10,7 @@ function resolveChangelogRenderer(changelogRendererPath) {
10
10
  workspaceRoot: workspace_root_1.workspaceRoot,
11
11
  });
12
12
  // Try and load the provided (or default) changelog renderer
13
- let changelogRenderer;
13
+ let ChangelogRendererClass;
14
14
  let cleanupTranspiler = () => { };
15
15
  try {
16
16
  const rootTsconfigPath = (0, typescript_1.getRootTsConfigPath)();
@@ -18,7 +18,7 @@ function resolveChangelogRenderer(changelogRendererPath) {
18
18
  cleanupTranspiler = (0, register_1.registerTsProject)(rootTsconfigPath);
19
19
  }
20
20
  const r = require(interpolatedChangelogRendererPath);
21
- changelogRenderer = r.default || r;
21
+ ChangelogRendererClass = r.default || r;
22
22
  }
23
23
  catch (err) {
24
24
  throw err;
@@ -26,5 +26,5 @@ function resolveChangelogRenderer(changelogRendererPath) {
26
26
  finally {
27
27
  cleanupTranspiler();
28
28
  }
29
- return changelogRenderer;
29
+ return ChangelogRendererClass;
30
30
  }
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveNxJsonConfigErrorMessage = resolveNxJsonConfigErrorMessage;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
- const devkit_exports_1 = require("../../../devkit-exports");
6
+ const path_1 = require("../../../utils/path");
7
+ const workspace_root_1 = require("../../../utils/workspace-root");
7
8
  async function resolveNxJsonConfigErrorMessage(propPath) {
8
- const errorLines = await getJsonConfigLinesForErrorMessage((0, node_fs_1.readFileSync)((0, devkit_exports_1.joinPathFragments)(devkit_exports_1.workspaceRoot, 'nx.json'), 'utf-8'), propPath);
9
- let nxJsonMessage = `The relevant config is defined here: ${(0, node_path_1.relative)(process.cwd(), (0, devkit_exports_1.joinPathFragments)(devkit_exports_1.workspaceRoot, 'nx.json'))}`;
9
+ const errorLines = await getJsonConfigLinesForErrorMessage((0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(workspace_root_1.workspaceRoot, 'nx.json'), 'utf-8'), propPath);
10
+ let nxJsonMessage = `The relevant config is defined here: ${(0, node_path_1.relative)(process.cwd(), (0, path_1.joinPathFragments)(workspace_root_1.workspaceRoot, 'nx.json'))}`;
10
11
  if (errorLines) {
11
12
  nxJsonMessage +=
12
13
  errorLines.startLine === errorLines.endLine
@@ -26,10 +26,10 @@ export interface ReleaseVersionGeneratorSchema {
26
26
  conventionalCommitsConfig?: NxReleaseConfig['conventionalCommits'];
27
27
  deleteVersionPlans?: boolean;
28
28
  /**
29
- * 'auto' allows users to opt into dependents being updated (a patch version bump) when a dependency is versioned.
30
- * This is only applicable to independently released projects.
29
+ * 'auto' is the default and will cause dependents to be updated (a patch version bump) when a dependency is versioned.
30
+ * This is only applicable to independently released projects. 'never' will cause dependents to not be updated.
31
31
  */
32
- updateDependents?: 'never' | 'auto';
32
+ updateDependents?: 'auto' | 'never';
33
33
  /**
34
34
  * Whether or not to completely omit project logs when that project has no applicable changes. This can be useful for
35
35
  * large monorepos which have a large number of projects, especially when only a subset are released together.
@@ -11,7 +11,6 @@ const split_target_1 = require("../../utils/split-target");
11
11
  const output_1 = require("../../utils/output");
12
12
  const configuration_1 = require("../../config/configuration");
13
13
  const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
14
- const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
15
14
  const graph_1 = require("../graph/graph");
16
15
  async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
17
16
  excludeTaskDependencies: args.excludeTaskDependencies,
@@ -19,7 +18,6 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
19
18
  }) {
20
19
  perf_hooks_1.performance.mark('code-loading:end');
21
20
  perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
22
- (0, workspace_configuration_check_1.workspaceConfigurationCheck)();
23
21
  const nxJson = (0, configuration_1.readNxJson)();
24
22
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
25
23
  const opts = parseRunOneOptions(cwd, args, projectGraph, nxJson);
@@ -100,7 +100,6 @@ async function runExecutorInternal({ project, target, configuration }, overrides
100
100
  target: targetConfig,
101
101
  projectsConfigurations,
102
102
  nxJsonConfiguration,
103
- workspace: { ...projectsConfigurations, ...nxJsonConfiguration },
104
103
  projectName: project,
105
104
  targetName: target,
106
105
  configurationName: configuration,
@@ -4,7 +4,6 @@ exports.runMany = runMany;
4
4
  exports.projectsToRun = projectsToRun;
5
5
  const run_command_1 = require("../../tasks-runner/run-command");
6
6
  const command_line_utils_1 = require("../../utils/command-line-utils");
7
- const command_line_utils_2 = require("../../utils/command-line-utils");
8
7
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
9
8
  const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
10
9
  const perf_hooks_1 = require("perf_hooks");
@@ -12,7 +11,6 @@ const project_graph_1 = require("../../project-graph/project-graph");
12
11
  const configuration_1 = require("../../config/configuration");
13
12
  const output_1 = require("../../utils/output");
14
13
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
15
- const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
16
14
  const graph_1 = require("../graph/graph");
17
15
  async function runMany(args, extraTargetDependencies = {}, extraOptions = {
18
16
  excludeTaskDependencies: args.excludeTaskDependencies,
@@ -20,9 +18,8 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = {
20
18
  }) {
21
19
  perf_hooks_1.performance.mark('code-loading:end');
22
20
  perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
23
- (0, workspace_configuration_check_1.workspaceConfigurationCheck)();
24
21
  const nxJson = (0, configuration_1.readNxJson)();
25
- const { nxArgs, overrides } = (0, command_line_utils_2.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
22
+ const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
26
23
  if (nxArgs.verbose) {
27
24
  process.env.NX_VERBOSE_LOGGING = 'true';
28
25
  }
@@ -81,9 +81,9 @@ function withRunOptions(yargs) {
81
81
  default: false,
82
82
  })
83
83
  .option('skipSync', {
84
+ describe: 'Skips running the sync generators associated with the tasks.',
84
85
  type: 'boolean',
85
- // TODO(leo): add description and make it visible once it is stable
86
- hidden: true,
86
+ default: false,
87
87
  })
88
88
  .options('cloud', {
89
89
  type: 'boolean',