nx 20.0.0-beta.6 → 20.0.0-beta.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/bin/init-local.js +0 -39
  2. package/bin/nx.js +3 -13
  3. package/migrations.json +5 -0
  4. package/package.json +11 -11
  5. package/release/changelog-renderer/index.d.ts +60 -38
  6. package/release/changelog-renderer/index.js +260 -236
  7. package/src/adapter/compat.d.ts +1 -1
  8. package/src/adapter/compat.js +1 -1
  9. package/src/command-line/add/add.js +2 -2
  10. package/src/command-line/affected/affected.js +0 -2
  11. package/src/command-line/nx-commands.js +31 -10
  12. package/src/command-line/release/changelog.d.ts +2 -2
  13. package/src/command-line/release/changelog.js +28 -29
  14. package/src/command-line/release/utils/git.js +2 -2
  15. package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
  16. package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
  17. package/src/command-line/run/run-one.js +0 -2
  18. package/src/command-line/run/run.js +0 -1
  19. package/src/command-line/run-many/run-many.js +1 -4
  20. package/src/command-line/yargs-utils/shared-options.js +2 -2
  21. package/src/config/misc-interfaces.d.ts +3 -15
  22. package/src/config/nx-json.d.ts +4 -3
  23. package/src/config/project-graph.d.ts +0 -2
  24. package/src/core/graph/main.js +1 -1
  25. package/src/daemon/client/client.js +1 -3
  26. package/src/devkit-exports.d.ts +3 -4
  27. package/src/devkit-exports.js +3 -6
  28. package/src/executors/utils/convert-nx-executor.js +0 -1
  29. package/src/generators/utils/nx-json.d.ts +1 -1
  30. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  31. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  32. package/src/native/nx.wasm32-wasi.wasm +0 -0
  33. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
  34. package/src/project-graph/build-project-graph.js +3 -41
  35. package/src/project-graph/error-types.d.ts +4 -10
  36. package/src/project-graph/error-types.js +1 -12
  37. package/src/project-graph/file-utils.js +1 -1
  38. package/src/project-graph/nx-deps-cache.d.ts +0 -1
  39. package/src/project-graph/nx-deps-cache.js +0 -1
  40. package/src/project-graph/plugins/internal-api.d.ts +2 -5
  41. package/src/project-graph/plugins/internal-api.js +0 -1
  42. package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
  43. package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
  44. package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
  45. package/src/project-graph/plugins/loader.js +2 -3
  46. package/src/project-graph/plugins/public-api.d.ts +6 -7
  47. package/src/project-graph/plugins/utils.d.ts +1 -7
  48. package/src/project-graph/plugins/utils.js +0 -37
  49. package/src/project-graph/utils/project-configuration-utils.js +1 -1
  50. package/src/tasks-runner/batch/run-batch.js +0 -1
  51. package/src/tasks-runner/cache.d.ts +2 -0
  52. package/src/tasks-runner/cache.js +7 -2
  53. package/src/tasks-runner/create-task-graph.js +4 -4
  54. package/src/tasks-runner/init-tasks-runner.js +0 -2
  55. package/src/tasks-runner/run-command.js +15 -2
  56. package/src/utils/command-line-utils.d.ts +3 -0
  57. package/src/utils/command-line-utils.js +24 -33
  58. package/src/utils/plugins/plugin-capabilities.js +2 -3
  59. package/src/utils/app-root.d.ts +0 -8
  60. package/src/utils/app-root.js +0 -12
  61. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  62. package/src/utils/nx-plugin.deprecated.js +0 -20
  63. package/src/utils/workspace-configuration-check.d.ts +0 -1
  64. package/src/utils/workspace-configuration-check.js +0 -36
package/bin/init-local.js CHANGED
@@ -5,7 +5,6 @@ exports.rewriteTargetsAndProjects = rewriteTargetsAndProjects;
5
5
  const perf_hooks_1 = require("perf_hooks");
6
6
  const nx_commands_1 = require("../src/command-line/nx-commands");
7
7
  const strip_indents_1 = require("../src/utils/strip-indents");
8
- const Mod = require("module");
9
8
  /**
10
9
  * Nx is being run inside a workspace.
11
10
  *
@@ -15,7 +14,6 @@ function initLocal(workspace) {
15
14
  process.env.NX_CLI_SET = 'true';
16
15
  try {
17
16
  perf_hooks_1.performance.mark('init-local');
18
- monkeyPatchRequire();
19
17
  if (workspace.type !== 'nx' && shouldDelegateToAngularCLI()) {
20
18
  console.warn((0, strip_indents_1.stripIndents) `Using Nx to run Angular CLI commands is deprecated and will be removed in a future version.
21
19
  To run Angular CLI commands, use \`ng\`.`);
@@ -144,40 +142,3 @@ To update the cache configuration, you can directly update the relevant options
144
142
  }
145
143
  }
146
144
  }
147
- // TODO(v17): Remove this once the @nrwl/* packages are not
148
- function monkeyPatchRequire() {
149
- const originalRequire = Mod.prototype.require;
150
- Mod.prototype.require = function (...args) {
151
- const modulePath = args[0];
152
- if (!modulePath.startsWith('@nrwl/')) {
153
- return originalRequire.apply(this, args);
154
- }
155
- else {
156
- try {
157
- // Try the original require
158
- return originalRequire.apply(this, args);
159
- }
160
- catch (e) {
161
- if (e.code !== 'MODULE_NOT_FOUND') {
162
- throw e;
163
- }
164
- try {
165
- // Retry the require with the @nx package
166
- return originalRequire.apply(this, args.map((value, i) => {
167
- if (i !== 0) {
168
- return value;
169
- }
170
- else {
171
- return value.replace('@nrwl/', '@nx/');
172
- }
173
- }));
174
- }
175
- catch {
176
- // Throw the original error
177
- throw e;
178
- }
179
- }
180
- }
181
- // do some side-effect of your own
182
- };
183
- }
package/bin/nx.js CHANGED
@@ -127,19 +127,9 @@ function resolveNx(workspace) {
127
127
  }
128
128
  catch { }
129
129
  // check for root install
130
- try {
131
- return require.resolve('nx/bin/nx.js', {
132
- paths: [workspace ? workspace.dir : globalsRoot],
133
- });
134
- }
135
- catch {
136
- // TODO(v17): Remove this
137
- // fallback for old CLI install setup
138
- // nx-ignore-next-line
139
- return require.resolve('@nrwl/cli/bin/nx.js', {
140
- paths: [workspace ? workspace.dir : globalsRoot],
141
- });
142
- }
130
+ return require.resolve('nx/bin/nx.js', {
131
+ paths: [workspace ? workspace.dir : globalsRoot],
132
+ });
143
133
  }
144
134
  function handleMissingLocalInstallation() {
145
135
  output_1.output.error({
package/migrations.json CHANGED
@@ -52,6 +52,11 @@
52
52
  "description": "Set project name in nx.json explicitly",
53
53
  "implementation": "./src/migrations/update-19-2-4/set-project-name",
54
54
  "x-repair-skip": true
55
+ },
56
+ "move-use-daemon-process": {
57
+ "version": "20.0.0-beta.7",
58
+ "description": "Migration for v20.0.0-beta.7",
59
+ "implementation": "./src/migrations/update-20-0-0/move-use-daemon-process"
55
60
  }
56
61
  }
57
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.0.0-beta.6",
3
+ "version": "20.0.0-beta.8",
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-beta.6",
84
- "@nx/nx-darwin-arm64": "20.0.0-beta.6",
85
- "@nx/nx-linux-x64-gnu": "20.0.0-beta.6",
86
- "@nx/nx-linux-x64-musl": "20.0.0-beta.6",
87
- "@nx/nx-win32-x64-msvc": "20.0.0-beta.6",
88
- "@nx/nx-linux-arm64-gnu": "20.0.0-beta.6",
89
- "@nx/nx-linux-arm64-musl": "20.0.0-beta.6",
90
- "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.6",
91
- "@nx/nx-win32-arm64-msvc": "20.0.0-beta.6",
92
- "@nx/nx-freebsd-x64": "20.0.0-beta.6"
83
+ "@nx/nx-darwin-x64": "20.0.0-beta.8",
84
+ "@nx/nx-darwin-arm64": "20.0.0-beta.8",
85
+ "@nx/nx-linux-x64-gnu": "20.0.0-beta.8",
86
+ "@nx/nx-linux-x64-musl": "20.0.0-beta.8",
87
+ "@nx/nx-win32-x64-msvc": "20.0.0-beta.8",
88
+ "@nx/nx-linux-arm64-gnu": "20.0.0-beta.8",
89
+ "@nx/nx-linux-arm64-musl": "20.0.0-beta.8",
90
+ "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.8",
91
+ "@nx/nx-win32-arm64-msvc": "20.0.0-beta.8",
92
+ "@nx/nx-freebsd-x64": "20.0.0-beta.8"
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
+ }