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
package/.eslintrc.json CHANGED
@@ -9,8 +9,18 @@
9
9
  "no-restricted-imports": [
10
10
  "error",
11
11
  {
12
- "name": "fs-extra",
13
- "message": "Please use equivalent utilities from `node:fs` instead."
12
+ "paths": [
13
+ {
14
+ "name": "fs-extra",
15
+ "message": "Please use equivalent utilities from `node:fs` instead."
16
+ }
17
+ ],
18
+ "patterns": [
19
+ {
20
+ "group": ["**/devkit-exports"],
21
+ "message": "Do not import from devkit-exports from the nx package"
22
+ }
23
+ ]
14
24
  }
15
25
  ]
16
26
  }
package/migrations.json CHANGED
@@ -1,42 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "16.0.0-remove-nrwl-cli": {
4
- "cli": "nx",
5
- "version": "16.0.0-beta.0",
6
- "description": "Remove @nrwl/cli.",
7
- "implementation": "./src/migrations/update-16-0-0/remove-nrwl-cli"
8
- },
9
- "16.0.0-tokens-for-depends-on": {
10
- "cli": "nx",
11
- "version": "16.0.0-beta.9",
12
- "description": "Replace `dependsOn.projects` and `inputs` definitions with new configuration format.",
13
- "implementation": "./src/migrations/update-16-0-0/update-depends-on-to-tokens"
14
- },
15
- "16.0.0-update-nx-cloud-runner": {
16
- "cli": "nx",
17
- "version": "16.0.0-beta.0",
18
- "description": "Replace @nrwl/nx-cloud with nx-cloud",
19
- "implementation": "./src/migrations/update-16-0-0/update-nx-cloud-runner"
20
- },
21
- "16.2.0-remove-output-path-from-run-commands": {
22
- "cli": "nx",
23
- "version": "16.2.0-beta.0",
24
- "description": "Remove outputPath from run commands",
25
- "implementation": "./src/migrations/update-16-2-0/remove-run-commands-output-path"
26
- },
27
- "16.6.0-prefix-outputs": {
28
- "cli": "nx",
29
- "version": "16.6.0-beta.6",
30
- "description": "Prefix outputs with {workspaceRoot}/{projectRoot} if needed",
31
- "implementation": "./src/migrations/update-15-0-0/prefix-outputs"
32
- },
33
- "16.8.0-escape-dollar-sign-env": {
34
- "cli": "nx",
35
- "version": "16.8.0-beta.3",
36
- "description": "Escape $ in env variables",
37
- "implementation": "./src/migrations/update-16-8-0/escape-dollar-sign-env-variables",
38
- "x-repair-skip": true
39
- },
40
3
  "17.0.0-move-cache-directory": {
41
4
  "cli": "nx",
42
5
  "version": "17.0.0-beta.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.0.0-canary.20241002-1d10a19",
3
+ "version": "20.0.0-canary.20241003-84a5c7a",
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": {
@@ -80,16 +80,16 @@
80
80
  }
81
81
  },
82
82
  "optionalDependencies": {
83
- "@nx/nx-darwin-x64": "20.0.0-canary.20241002-1d10a19",
84
- "@nx/nx-darwin-arm64": "20.0.0-canary.20241002-1d10a19",
85
- "@nx/nx-linux-x64-gnu": "20.0.0-canary.20241002-1d10a19",
86
- "@nx/nx-linux-x64-musl": "20.0.0-canary.20241002-1d10a19",
87
- "@nx/nx-win32-x64-msvc": "20.0.0-canary.20241002-1d10a19",
88
- "@nx/nx-linux-arm64-gnu": "20.0.0-canary.20241002-1d10a19",
89
- "@nx/nx-linux-arm64-musl": "20.0.0-canary.20241002-1d10a19",
90
- "@nx/nx-linux-arm-gnueabihf": "20.0.0-canary.20241002-1d10a19",
91
- "@nx/nx-win32-arm64-msvc": "20.0.0-canary.20241002-1d10a19",
92
- "@nx/nx-freebsd-x64": "20.0.0-canary.20241002-1d10a19"
83
+ "@nx/nx-darwin-x64": "20.0.0-canary.20241003-84a5c7a",
84
+ "@nx/nx-darwin-arm64": "20.0.0-canary.20241003-84a5c7a",
85
+ "@nx/nx-linux-x64-gnu": "20.0.0-canary.20241003-84a5c7a",
86
+ "@nx/nx-linux-x64-musl": "20.0.0-canary.20241003-84a5c7a",
87
+ "@nx/nx-win32-x64-msvc": "20.0.0-canary.20241003-84a5c7a",
88
+ "@nx/nx-linux-arm64-gnu": "20.0.0-canary.20241003-84a5c7a",
89
+ "@nx/nx-linux-arm64-musl": "20.0.0-canary.20241003-84a5c7a",
90
+ "@nx/nx-linux-arm-gnueabihf": "20.0.0-canary.20241003-84a5c7a",
91
+ "@nx/nx-win32-arm64-msvc": "20.0.0-canary.20241003-84a5c7a",
92
+ "@nx/nx-freebsd-x64": "20.0.0-canary.20241003-84a5c7a"
93
93
  },
94
94
  "nx-migrations": {
95
95
  "migrations": "./migrations.json",
@@ -1,15 +1,13 @@
1
1
  import { ChangelogChange } from '../../src/command-line/release/changelog';
2
2
  import { NxReleaseConfig } from '../../src/command-line/release/config/config';
3
- import { GitCommit } from '../../src/command-line/release/utils/git';
4
- import { GithubRepoData, RepoSlug } from '../../src/command-line/release/utils/github';
5
- import type { ProjectGraph } from '../../src/config/project-graph';
3
+ import { GithubRepoData } from '../../src/command-line/release/utils/github';
6
4
  /**
7
5
  * The ChangelogRenderOptions are specific to each ChangelogRenderer implementation, and are taken
8
6
  * from the user's nx.json configuration and passed as is into the ChangelogRenderer function.
9
7
  */
10
8
  export type ChangelogRenderOptions = Record<string, unknown>;
11
9
  /**
12
- * When versioning projects independently and enabling `"updateDependents": "always"`, there could
10
+ * When versioning projects independently and enabling `"updateDependents": "auto"`, there could
13
11
  * be additional dependency bump information that is not captured in the commit data, but that nevertheless
14
12
  * should be included in the rendered changelog.
15
13
  */
@@ -17,34 +15,6 @@ export type DependencyBump = {
17
15
  dependencyName: string;
18
16
  newVersion: string;
19
17
  };
20
- /**
21
- * A ChangelogRenderer function takes in the extracted commits and other relevant metadata
22
- * and returns a string, or a Promise of a string of changelog contents (usually markdown).
23
- *
24
- * @param {Object} config The configuration object for the ChangelogRenderer
25
- * @param {ProjectGraph} config.projectGraph The project graph for the workspace
26
- * @param {GitCommit[]} config.commits DEPRECATED [Use 'config.changes' instead] - The collection of extracted commits to generate a changelog for
27
- * @param {ChangelogChange[]} config.changes The collection of changes to show in the changelog
28
- * @param {string} config.releaseVersion The version that is being released
29
- * @param {string | null} config.project The name of specific project to generate a changelog for, or `null` if the overall workspace changelog
30
- * @param {string | false} config.entryWhenNoChanges The (already interpolated) string to use as the changelog entry when there are no changes, or `false` if no entry should be generated
31
- * @param {ChangelogRenderOptions} config.changelogRenderOptions The options specific to the ChangelogRenderer implementation
32
- * @param {DependencyBump[]} config.dependencyBumps Optional list of additional dependency bumps that occurred as part of the release, outside of the commit data
33
- * @param {GithubRepoData} config.repoData Resolved data for the current GitHub repository
34
- */
35
- export type ChangelogRenderer = (config: {
36
- projectGraph: ProjectGraph;
37
- commits?: GitCommit[];
38
- changes?: ChangelogChange[];
39
- releaseVersion: string;
40
- project: string | null;
41
- entryWhenNoChanges: string | false;
42
- changelogRenderOptions: DefaultChangelogRenderOptions;
43
- dependencyBumps?: DependencyBump[];
44
- repoSlug?: RepoSlug;
45
- repoData?: GithubRepoData;
46
- conventionalCommitsConfig: NxReleaseConfig['conventionalCommits'] | null;
47
- }) => Promise<string> | string;
48
18
  /**
49
19
  * The specific options available to the default implementation of the ChangelogRenderer that nx exports
50
20
  * for the common case.
@@ -72,9 +42,61 @@ export interface DefaultChangelogRenderOptions extends ChangelogRenderOptions {
72
42
  */
73
43
  versionTitleDate?: boolean;
74
44
  }
75
- /**
76
- * The default ChangelogRenderer implementation that nx exports for the common case of generating markdown
77
- * from the given commits and other metadata.
78
- */
79
- declare const defaultChangelogRenderer: ChangelogRenderer;
80
- export default defaultChangelogRenderer;
45
+ export default class DefaultChangelogRenderer {
46
+ protected changes: ChangelogChange[];
47
+ protected changelogEntryVersion: string;
48
+ protected project: string | null;
49
+ protected entryWhenNoChanges: string | false;
50
+ protected changelogRenderOptions: DefaultChangelogRenderOptions;
51
+ protected isVersionPlans: boolean;
52
+ protected dependencyBumps?: DependencyBump[];
53
+ protected repoData?: GithubRepoData;
54
+ protected conventionalCommitsConfig: NxReleaseConfig['conventionalCommits'] | null;
55
+ protected relevantChanges: ChangelogChange[];
56
+ protected breakingChanges: string[];
57
+ protected additionalChangesForAuthorsSection: ChangelogChange[];
58
+ /**
59
+ * A ChangelogRenderer class takes in the determined changes and other relevant metadata
60
+ * and returns a string, or a Promise of a string of changelog contents (usually markdown).
61
+ *
62
+ * @param {Object} config The configuration object for the ChangelogRenderer
63
+ * @param {ChangelogChange[]} config.changes The collection of changes to show in the changelog
64
+ * @param {string} config.changelogEntryVersion The version for which we are rendering the current changelog entry
65
+ * @param {string | null} config.project The name of specific project to generate a changelog entry for, or `null` if the overall workspace changelog
66
+ * @param {string | false} config.entryWhenNoChanges The (already interpolated) string to use as the changelog entry when there are no changes, or `false` if no entry should be generated
67
+ * @param {boolean} config.isVersionPlans Whether or not Nx release version plans are the source of truth for the changelog entry
68
+ * @param {ChangelogRenderOptions} config.changelogRenderOptions The options specific to the ChangelogRenderer implementation
69
+ * @param {DependencyBump[]} config.dependencyBumps Optional list of additional dependency bumps that occurred as part of the release, outside of the change data
70
+ * @param {GithubRepoData} config.repoData Resolved data for the current GitHub repository
71
+ * @param {NxReleaseConfig['conventionalCommits'] | null} config.conventionalCommitsConfig The configuration for conventional commits, or null if version plans are being used
72
+ */
73
+ constructor(config: {
74
+ changes: ChangelogChange[];
75
+ changelogEntryVersion: string;
76
+ project: string | null;
77
+ entryWhenNoChanges: string | false;
78
+ isVersionPlans: boolean;
79
+ changelogRenderOptions: DefaultChangelogRenderOptions;
80
+ dependencyBumps?: DependencyBump[];
81
+ repoData?: GithubRepoData;
82
+ conventionalCommitsConfig: NxReleaseConfig['conventionalCommits'] | null;
83
+ });
84
+ protected filterChanges(changes: ChangelogChange[], project: string | null): ChangelogChange[];
85
+ render(): Promise<string>;
86
+ protected preprocessChanges(): void;
87
+ protected shouldRenderEmptyEntry(): boolean;
88
+ protected renderEmptyEntry(): string;
89
+ protected renderVersionTitle(): string;
90
+ protected renderChangesByType(): string[];
91
+ protected hasBreakingChanges(): boolean;
92
+ protected renderBreakingChanges(): string[];
93
+ protected hasDependencyBumps(): boolean;
94
+ protected renderDependencyBumps(): string[];
95
+ protected shouldRenderAuthors(): boolean;
96
+ protected renderAuthors(): Promise<string[]>;
97
+ protected formatChange(change: ChangelogChange): string;
98
+ protected groupChangesByType(): Record<string, ChangelogChange[]>;
99
+ protected groupChangesByScope(changes: ChangelogChange[]): Record<string, ChangelogChange[]>;
100
+ protected extractBreakingChangeExplanation(message: string): string | null;
101
+ protected formatName(name?: string): string;
102
+ }