nx 20.0.0-canary.20241002-1d10a19 → 20.0.0-canary.20241003-84a5c7a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/.eslintrc.json +12 -2
  2. package/migrations.json +0 -37
  3. package/package.json +11 -11
  4. package/release/changelog-renderer/index.d.ts +60 -38
  5. package/release/changelog-renderer/index.js +260 -236
  6. package/src/command-line/add/add.js +2 -2
  7. package/src/command-line/nx-commands.js +31 -10
  8. package/src/command-line/release/changelog.d.ts +2 -2
  9. package/src/command-line/release/changelog.js +28 -29
  10. package/src/command-line/release/index.d.ts +5 -2
  11. package/src/command-line/release/publish.d.ts +6 -1
  12. package/src/command-line/release/publish.js +31 -25
  13. package/src/command-line/release/utils/print-changes.js +6 -4
  14. package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
  15. package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
  16. package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
  17. package/src/command-line/release/version.d.ts +3 -3
  18. package/src/command-line/yargs-utils/shared-options.js +2 -2
  19. package/src/config/nx-json.d.ts +2 -1
  20. package/src/native/nx.wasm32-wasi.wasm +0 -0
  21. package/src/nx-cloud/utilities/axios.js +1 -2
  22. package/src/nx-cloud/utilities/onboarding.js +2 -2
  23. package/src/nx-cloud/utilities/url-shorten.js +5 -5
  24. package/src/project-graph/file-utils.d.ts +2 -2
  25. package/src/project-graph/file-utils.js +2 -2
  26. package/src/tasks-runner/cache.d.ts +2 -1
  27. package/src/tasks-runner/cache.js +10 -6
  28. package/src/tasks-runner/create-task-graph.d.ts +2 -0
  29. package/src/tasks-runner/create-task-graph.js +39 -5
  30. package/src/tasks-runner/run-command.js +15 -2
  31. package/src/tasks-runner/task-orchestrator.js +1 -1
  32. package/src/utils/command-line-utils.d.ts +3 -0
  33. package/src/utils/git-utils.js +2 -2
  34. package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
  35. package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
  36. package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
  37. package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
  38. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
  39. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
  40. package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
  41. package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
  42. package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
  43. package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
  44. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
  45. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
@@ -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
  }
@@ -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.
@@ -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',
@@ -353,7 +353,8 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
353
353
  appsDir?: string;
354
354
  };
355
355
  /**
356
- * Available Task Runners
356
+ * @deprecated Custom task runners will no longer be supported in Nx 21. Use Nx Cloud or Nx Powerpack instead.
357
+ * Available Task Runners for Nx to use
357
358
  */
358
359
  tasksRunnerOptions?: {
359
360
  [tasksRunnerName: string]: {
Binary file
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createApiAxiosInstance = createApiAxiosInstance;
4
4
  const path_1 = require("path");
5
5
  const environment_1 = require("./environment");
6
- const axios = require('axios');
7
6
  function createApiAxiosInstance(options) {
8
7
  let axiosConfigBuilder = (axiosConfig) => axiosConfig;
9
8
  const baseUrl = process.env.NX_CLOUD_API || options.url || 'https://cloud.nx.app';
@@ -17,7 +16,7 @@ function createApiAxiosInstance(options) {
17
16
  const { nxCloudProxyConfig } = require((0, path_1.join)(process.cwd(), options.customProxyConfigPath));
18
17
  axiosConfigBuilder = nxCloudProxyConfig ?? axiosConfigBuilder;
19
18
  }
20
- return axios.create(axiosConfigBuilder({
19
+ return require('axios').create(axiosConfigBuilder({
21
20
  baseURL: baseUrl,
22
21
  timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
23
22
  headers: { authorization: accessToken },
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNxCloudOnboardingURLForWelcomeApp = createNxCloudOnboardingURLForWelcomeApp;
4
4
  exports.getNxCloudAppOnBoardingUrl = getNxCloudAppOnBoardingUrl;
5
5
  exports.readNxCloudToken = readNxCloudToken;
6
- const devkit_exports_1 = require("../../devkit-exports");
7
6
  const is_workspace_claimed_1 = require("./is-workspace-claimed");
8
7
  const url_shorten_1 = require("./url-shorten");
9
8
  const run_command_1 = require("../../tasks-runner/run-command");
9
+ const nx_json_1 = require("../../generators/utils/nx-json");
10
10
  async function createNxCloudOnboardingURLForWelcomeApp(tree, token) {
11
11
  token = token || readNxCloudToken(tree);
12
12
  if (!token) {
@@ -22,7 +22,7 @@ async function getNxCloudAppOnBoardingUrl(token) {
22
22
  return onboardingUrl;
23
23
  }
24
24
  function readNxCloudToken(tree) {
25
- const nxJson = (0, devkit_exports_1.readNxJson)(tree);
25
+ const nxJson = (0, nx_json_1.readNxJson)(tree);
26
26
  const { accessToken, nxCloudId } = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
27
27
  return accessToken || nxCloudId;
28
28
  }
@@ -7,7 +7,7 @@ exports.getNxCloudVersion = getNxCloudVersion;
7
7
  exports.removeVersionModifier = removeVersionModifier;
8
8
  exports.versionIsValid = versionIsValid;
9
9
  exports.compareCleanCloudVersions = compareCleanCloudVersions;
10
- const devkit_exports_1 = require("../../devkit-exports");
10
+ const logger_1 = require("../../utils/logger");
11
11
  const git_utils_1 = require("../../utils/git-utils");
12
12
  const get_cloud_options_1 = require("./get-cloud-options");
13
13
  /**
@@ -27,7 +27,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
27
27
  }
28
28
  }
29
29
  catch (e) {
30
- devkit_exports_1.logger.verbose(`Failed to get Nx Cloud version.
30
+ logger_1.logger.verbose(`Failed to get Nx Cloud version.
31
31
  ${e}`);
32
32
  return apiUrl;
33
33
  }
@@ -46,7 +46,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
46
46
  return `${apiUrl}/connect/${response.data}`;
47
47
  }
48
48
  catch (e) {
49
- devkit_exports_1.logger.verbose(`Failed to shorten Nx Cloud URL.
49
+ logger_1.logger.verbose(`Failed to shorten Nx Cloud URL.
50
50
  ${e}`);
51
51
  return getURLifShortenFailed(usesGithub, githubSlug === 'github' ? null : githubSlug, apiUrl, source, accessToken);
52
52
  }
@@ -96,7 +96,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
96
96
  }
97
97
  catch (e) {
98
98
  if (process.env.NX_VERBOSE_LOGGING === 'true') {
99
- devkit_exports_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
99
+ logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
100
100
  ${e}`);
101
101
  }
102
102
  return false;
@@ -116,7 +116,7 @@ async function getNxCloudVersion(apiUrl) {
116
116
  return version;
117
117
  }
118
118
  catch (e) {
119
- devkit_exports_1.logger.verbose(`Failed to get version of Nx Cloud.
119
+ logger_1.logger.verbose(`Failed to get version of Nx Cloud.
120
120
  ${e}`);
121
121
  return null;
122
122
  }
@@ -18,8 +18,8 @@ export declare function isDeletedFileChange(change: Change): change is DeletedFi
18
18
  export declare function calculateFileChanges(files: string[], allWorkspaceFiles: FileData[], nxArgs?: NxArgs, readFileAtRevision?: (f: string, r: void | string) => string, ignore?: ReturnType<typeof ignore>): FileChange[];
19
19
  export declare const TEN_MEGABYTES: number;
20
20
  /**
21
- * TODO(v20): Remove this function
22
- * @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v20.
21
+ * TODO(v21): Remove this function
22
+ * @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
23
23
  */
24
24
  export declare function readWorkspaceConfig(opts: {
25
25
  format: 'angularCli' | 'nx';
@@ -101,8 +101,8 @@ function defaultReadFileAtRevision(file, revision) {
101
101
  }
102
102
  }
103
103
  /**
104
- * TODO(v20): Remove this function
105
- * @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v20.
104
+ * TODO(v21): Remove this function
105
+ * @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
106
106
  */
107
107
  function readWorkspaceConfig(opts) {
108
108
  let configuration = null;
@@ -11,7 +11,8 @@ export type TaskWithCachedResult = {
11
11
  task: Task;
12
12
  cachedResult: CachedResult;
13
13
  };
14
- export declare function getCache(nxJson: NxJsonConfiguration, options: DefaultTasksRunnerOptions): DbCache | Cache;
14
+ export declare function dbCacheEnabled(nxJson?: NxJsonConfiguration): boolean;
15
+ export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
15
16
  export declare class DbCache {
16
17
  private readonly options;
17
18
  private cache;