nx 21.0.0-beta.11 → 21.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/migrations.json +10 -5
  2. package/package.json +11 -11
  3. package/release/changelog-renderer/index.d.ts +7 -7
  4. package/release/changelog-renderer/index.js +12 -31
  5. package/schemas/nx-schema.json +3 -3
  6. package/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
  7. package/src/command-line/migrate/migrate-ui-api.js +4 -3
  8. package/src/command-line/release/changelog.d.ts +3 -2
  9. package/src/command-line/release/changelog.js +57 -70
  10. package/src/command-line/release/command-object.d.ts +1 -1
  11. package/src/command-line/release/config/config.d.ts +8 -1
  12. package/src/command-line/release/config/config.js +18 -11
  13. package/src/command-line/release/release.js +30 -18
  14. package/src/command-line/release/utils/git.d.ts +1 -0
  15. package/src/command-line/release/utils/git.js +27 -8
  16. package/src/command-line/release/utils/remote-release-clients/github.d.ts +57 -0
  17. package/src/command-line/release/utils/remote-release-clients/github.js +309 -0
  18. package/src/command-line/release/utils/remote-release-clients/gitlab.d.ts +62 -0
  19. package/src/command-line/release/utils/remote-release-clients/gitlab.js +271 -0
  20. package/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +111 -0
  21. package/src/command-line/release/utils/remote-release-clients/remote-release-client.js +136 -0
  22. package/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  23. package/src/command-line/yargs-utils/shared-options.js +22 -3
  24. package/src/config/nx-json.d.ts +8 -1
  25. package/src/core/graph/main.js +1 -1
  26. package/src/core/graph/styles.css +1 -1
  27. package/src/migrations/update-21-0-0/release-changelog-config-changes.d.ts +2 -0
  28. package/src/migrations/update-21-0-0/release-changelog-config-changes.js +38 -0
  29. package/src/native/index.d.ts +6 -1
  30. package/src/native/native-bindings.js +1 -0
  31. package/src/native/native-file-cache-location.js +2 -1
  32. package/src/native/nx.wasm32-wasi.wasm +0 -0
  33. package/src/project-graph/plugins/get-plugins.js +19 -14
  34. package/src/tasks-runner/is-tui-enabled.d.ts +16 -1
  35. package/src/tasks-runner/is-tui-enabled.js +40 -28
  36. package/src/tasks-runner/run-command.js +3 -3
  37. package/src/tasks-runner/running-tasks/node-child-process.d.ts +1 -0
  38. package/src/tasks-runner/running-tasks/node-child-process.js +7 -0
  39. package/src/tasks-runner/task-orchestrator.js +6 -3
  40. package/src/utils/is-ci.d.ts +1 -1
  41. package/src/utils/is-ci.js +4 -1
  42. package/src/utils/package-manager.d.ts +1 -0
  43. package/src/utils/package-manager.js +29 -16
  44. package/src/command-line/release/utils/github.d.ts +0 -32
  45. package/src/command-line/release/utils/github.js +0 -326
package/migrations.json CHANGED
@@ -29,11 +29,6 @@
29
29
  "implementation": "./src/migrations/update-20-0-1/use-legacy-cache",
30
30
  "x-repair-skip": true
31
31
  },
32
- "release-version-config-changes": {
33
- "version": "21.0.0-beta.1",
34
- "description": "Updates release version config based on the breaking changes in Nx v21",
35
- "implementation": "./src/migrations/update-21-0-0/release-version-config-changes"
36
- },
37
32
  "remove-legacy-cache": {
38
33
  "version": "21.0.0-beta.8",
39
34
  "description": "Removes the legacy cache configuration from nx.json",
@@ -43,6 +38,16 @@
43
38
  "version": "21.0.0-beta.8",
44
39
  "description": "Removes the legacy cache configuration from nx.json",
45
40
  "implementation": "./src/migrations/update-21-0-0/remove-custom-tasks-runner"
41
+ },
42
+ "release-version-config-changes": {
43
+ "version": "21.0.0-beta.11",
44
+ "description": "Updates release version config based on the breaking changes in Nx v21",
45
+ "implementation": "./src/migrations/update-21-0-0/release-version-config-changes"
46
+ },
47
+ "release-changelog-config-changes": {
48
+ "version": "21.0.0-beta.11",
49
+ "description": "Updates release changelog config based on the breaking changes in Nx v21",
50
+ "implementation": "./src/migrations/update-21-0-0/release-changelog-config-changes"
46
51
  }
47
52
  }
48
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.0.0-beta.11",
3
+ "version": "21.0.0-beta.12",
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": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.0.0-beta.11",
87
- "@nx/nx-darwin-x64": "21.0.0-beta.11",
88
- "@nx/nx-freebsd-x64": "21.0.0-beta.11",
89
- "@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.11",
90
- "@nx/nx-linux-arm64-gnu": "21.0.0-beta.11",
91
- "@nx/nx-linux-arm64-musl": "21.0.0-beta.11",
92
- "@nx/nx-linux-x64-gnu": "21.0.0-beta.11",
93
- "@nx/nx-linux-x64-musl": "21.0.0-beta.11",
94
- "@nx/nx-win32-arm64-msvc": "21.0.0-beta.11",
95
- "@nx/nx-win32-x64-msvc": "21.0.0-beta.11"
86
+ "@nx/nx-darwin-arm64": "21.0.0-beta.12",
87
+ "@nx/nx-darwin-x64": "21.0.0-beta.12",
88
+ "@nx/nx-freebsd-x64": "21.0.0-beta.12",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.12",
90
+ "@nx/nx-linux-arm64-gnu": "21.0.0-beta.12",
91
+ "@nx/nx-linux-arm64-musl": "21.0.0-beta.12",
92
+ "@nx/nx-linux-x64-gnu": "21.0.0-beta.12",
93
+ "@nx/nx-linux-x64-musl": "21.0.0-beta.12",
94
+ "@nx/nx-win32-arm64-msvc": "21.0.0-beta.12",
95
+ "@nx/nx-win32-x64-msvc": "21.0.0-beta.12"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -1,6 +1,6 @@
1
- import { ChangelogChange } from '../../src/command-line/release/changelog';
2
- import { NxReleaseConfig } from '../../src/command-line/release/config/config';
3
- import { GithubRepoData } from '../../src/command-line/release/utils/github';
1
+ import type { ChangelogChange } from '../../src/command-line/release/changelog';
2
+ import type { NxReleaseConfig } from '../../src/command-line/release/config/config';
3
+ import type { RemoteReleaseClient } from '../../src/command-line/release/utils/remote-release-clients/remote-release-client';
4
4
  /**
5
5
  * The ChangelogRenderOptions are specific to each ChangelogRenderer implementation, and are taken
6
6
  * from the user's nx.json configuration and passed as is into the ChangelogRenderer function.
@@ -30,7 +30,7 @@ export interface DefaultChangelogRenderOptions extends ChangelogRenderOptions {
30
30
  * using https://ungh.cc (from https://github.com/unjs/ungh) and the email addresses found in the commits.
31
31
  * Defaults to true.
32
32
  */
33
- mapAuthorsToGitHubUsernames?: boolean;
33
+ applyUsernameToAuthors?: boolean;
34
34
  /**
35
35
  * Whether or not the commit references (such as commit and/or PR links) should be included in the changelog.
36
36
  * Defaults to true.
@@ -50,11 +50,11 @@ export default class DefaultChangelogRenderer {
50
50
  protected changelogRenderOptions: DefaultChangelogRenderOptions;
51
51
  protected isVersionPlans: boolean;
52
52
  protected dependencyBumps?: DependencyBump[];
53
- protected repoData?: GithubRepoData;
54
53
  protected conventionalCommitsConfig: NxReleaseConfig['conventionalCommits'] | null;
55
54
  protected relevantChanges: ChangelogChange[];
56
55
  protected breakingChanges: string[];
57
56
  protected additionalChangesForAuthorsSection: ChangelogChange[];
57
+ protected remoteReleaseClient: RemoteReleaseClient<unknown>;
58
58
  /**
59
59
  * A ChangelogRenderer class takes in the determined changes and other relevant metadata
60
60
  * and returns a string, or a Promise of a string of changelog contents (usually markdown).
@@ -67,8 +67,8 @@ export default class DefaultChangelogRenderer {
67
67
  * @param {boolean} config.isVersionPlans Whether or not Nx release version plans are the source of truth for the changelog entry
68
68
  * @param {ChangelogRenderOptions} config.changelogRenderOptions The options specific to the ChangelogRenderer implementation
69
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
70
  * @param {NxReleaseConfig['conventionalCommits'] | null} config.conventionalCommitsConfig The configuration for conventional commits, or null if version plans are being used
71
+ * @param {RemoteReleaseClient} config.remoteReleaseClient The remote release client to use for formatting references
72
72
  */
73
73
  constructor(config: {
74
74
  changes: ChangelogChange[];
@@ -78,8 +78,8 @@ export default class DefaultChangelogRenderer {
78
78
  isVersionPlans: boolean;
79
79
  changelogRenderOptions: DefaultChangelogRenderOptions;
80
80
  dependencyBumps?: DependencyBump[];
81
- repoData?: GithubRepoData;
82
81
  conventionalCommitsConfig: NxReleaseConfig['conventionalCommits'] | null;
82
+ remoteReleaseClient: RemoteReleaseClient<unknown>;
83
83
  });
84
84
  protected filterChanges(changes: ChangelogChange[], project: string | null): ChangelogChange[];
85
85
  render(): Promise<string>;
@@ -2,10 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const semver_1 = require("semver");
4
4
  const conventional_commits_1 = require("../../src/command-line/release/config/conventional-commits");
5
- const github_1 = require("../../src/command-line/release/utils/github");
6
- // axios types and values don't seem to match
7
- const _axios = require("axios");
8
- const axios = _axios;
9
5
  class DefaultChangelogRenderer {
10
6
  /**
11
7
  * A ChangelogRenderer class takes in the determined changes and other relevant metadata
@@ -19,8 +15,8 @@ class DefaultChangelogRenderer {
19
15
  * @param {boolean} config.isVersionPlans Whether or not Nx release version plans are the source of truth for the changelog entry
20
16
  * @param {ChangelogRenderOptions} config.changelogRenderOptions The options specific to the ChangelogRenderer implementation
21
17
  * @param {DependencyBump[]} config.dependencyBumps Optional list of additional dependency bumps that occurred as part of the release, outside of the change data
22
- * @param {GithubRepoData} config.repoData Resolved data for the current GitHub repository
23
18
  * @param {NxReleaseConfig['conventionalCommits'] | null} config.conventionalCommitsConfig The configuration for conventional commits, or null if version plans are being used
19
+ * @param {RemoteReleaseClient} config.remoteReleaseClient The remote release client to use for formatting references
24
20
  */
25
21
  constructor(config) {
26
22
  this.changes = this.filterChanges(config.changes, config.project);
@@ -30,8 +26,8 @@ class DefaultChangelogRenderer {
30
26
  this.isVersionPlans = config.isVersionPlans;
31
27
  this.changelogRenderOptions = config.changelogRenderOptions;
32
28
  this.dependencyBumps = config.dependencyBumps;
33
- this.repoData = config.repoData;
34
29
  this.conventionalCommitsConfig = config.conventionalCommitsConfig;
30
+ this.remoteReleaseClient = config.remoteReleaseClient;
35
31
  this.relevantChanges = [];
36
32
  this.breakingChanges = [];
37
33
  this.additionalChangesForAuthorsSection = [];
@@ -234,27 +230,11 @@ class DefaultChangelogRenderer {
234
230
  }
235
231
  }
236
232
  }
237
- if (this.repoData &&
238
- this.changelogRenderOptions.mapAuthorsToGitHubUsernames) {
239
- await Promise.all([..._authors.keys()].map(async (authorName) => {
240
- const meta = _authors.get(authorName);
241
- for (const email of meta.email) {
242
- if (email.endsWith('@users.noreply.github.com')) {
243
- const match = email.match(/^(\d+\+)?([^@]+)@users\.noreply\.github\.com$/);
244
- if (match && match[2]) {
245
- meta.github = match[2];
246
- break;
247
- }
248
- }
249
- const { data } = await axios
250
- .get(`https://ungh.cc/users/find/${email}`)
251
- .catch(() => ({ data: { user: null } }));
252
- if (data?.user) {
253
- meta.github = data.user.username;
254
- break;
255
- }
256
- }
257
- }));
233
+ if (this.remoteReleaseClient.getRemoteRepoData() &&
234
+ this.changelogRenderOptions.applyUsernameToAuthors &&
235
+ // TODO: Explore if it is possible to support GitLab username resolution
236
+ this.remoteReleaseClient.remoteReleaseProviderName === 'GitHub') {
237
+ await this.remoteReleaseClient.applyUsernameToAuthors(_authors);
258
238
  }
259
239
  const authors = [..._authors.entries()].map((e) => ({
260
240
  name: e[0],
@@ -264,8 +244,8 @@ class DefaultChangelogRenderer {
264
244
  markdownLines.push('', '### ' + '❤️ Thank You', '', ...authors
265
245
  .sort((a, b) => a.name.localeCompare(b.name))
266
246
  .map((i) => {
267
- const github = i.github ? ` @${i.github}` : '';
268
- return `- ${i.name}${github}`;
247
+ const username = i.username ? ` @${i.username}` : '';
248
+ return `- ${i.name}${username}`;
269
249
  }));
270
250
  }
271
251
  return markdownLines;
@@ -288,8 +268,9 @@ class DefaultChangelogRenderer {
288
268
  ? `**${change.scope.trim()}:** `
289
269
  : '') +
290
270
  description;
291
- if (this.repoData && this.changelogRenderOptions.commitReferences) {
292
- changeLine += (0, github_1.formatReferences)(change.githubReferences, this.repoData);
271
+ if (this.remoteReleaseClient.getRemoteRepoData() &&
272
+ this.changelogRenderOptions.commitReferences) {
273
+ changeLine += this.remoteReleaseClient.formatReferences(change.githubReferences);
293
274
  }
294
275
  if (extraLinesStr) {
295
276
  changeLine += '\n\n' + extraLinesStr;
@@ -854,7 +854,7 @@
854
854
  "oneOf": [
855
855
  {
856
856
  "type": "string",
857
- "enum": ["github"]
857
+ "enum": ["github", "gitlab"]
858
858
  },
859
859
  {
860
860
  "type": "boolean",
@@ -900,7 +900,7 @@
900
900
  "properties": {
901
901
  "provider": {
902
902
  "type": "string",
903
- "enum": ["github-enterprise-server"]
903
+ "enum": ["github-enterprise-server", "gitlab"]
904
904
  },
905
905
  "hostname": {
906
906
  "type": "string",
@@ -908,7 +908,7 @@
908
908
  },
909
909
  "apiBaseUrl": {
910
910
  "type": "string",
911
- "description": "The base URL for the relevant VCS provider API. If not set, this will default to `https://${hostname}/api/v3`"
911
+ "description": "The base URL for the relevant VCS provider API. If not set, this will default to `https://${hostname}/api/v3` (github) or `https://${hostname}/api/v4` (gitlab)."
912
912
  }
913
913
  },
914
914
  "required": ["provider", "hostname"]
@@ -15,6 +15,7 @@ export type SuccessfulMigration = {
15
15
  name: string;
16
16
  changedFiles: Omit<FileChange, 'content'>[];
17
17
  ref: string;
18
+ nextSteps?: string[];
18
19
  };
19
20
  export type FailedMigration = {
20
21
  type: 'failed';
@@ -32,7 +33,7 @@ export declare function runSingleMigration(workspacePath: string, migration: Mig
32
33
  }): Promise<void>;
33
34
  export declare function getImplementationPath(workspacePath: string, migration: MigrationDetailsWithId): Promise<string>;
34
35
  export declare function modifyMigrationsJsonMetadata(workspacePath: string, modify: (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata): void;
35
- export declare function addSuccessfulMigration(id: string, fileChanges: Omit<FileChange, 'content'>[], ref: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
36
+ export declare function addSuccessfulMigration(id: string, fileChanges: Omit<FileChange, 'content'>[], ref: string, nextSteps: string[]): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
36
37
  export declare function updateRefForSuccessfulMigration(id: string, ref: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
37
38
  export declare function addFailedMigration(id: string, error: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => {
38
39
  completedMigrations?: Record<string, SuccessfulMigration | FailedMigration | SkippedMigration>;
@@ -72,7 +72,7 @@ async function runSingleMigration(workspacePath, migration, configuration) {
72
72
  // 1. The CLI path to the migrated modules. The version of Nx is of the user's choosing. This may or may not have the new migrate API, so Console will check that `runSingleMigration` exists before using it.
73
73
  // 2. Bundled into Console, so the version is fixed to what we build Console with.
74
74
  const updatedMigrateModule = await Promise.resolve().then(() => require('./migrate.js'));
75
- const { changes: fileChanges } = await updatedMigrateModule.runNxOrAngularMigration(workspacePath, migration, false, configuration.createCommits, configuration.commitPrefix || 'chore: [nx migration] ', undefined, true);
75
+ const { changes: fileChanges, nextSteps } = await updatedMigrateModule.runNxOrAngularMigration(workspacePath, migration, false, configuration.createCommits, configuration.commitPrefix || 'chore: [nx migration] ', undefined, true);
76
76
  const gitRefAfter = (0, child_process_1.execSync)('git rev-parse HEAD', {
77
77
  cwd: workspacePath,
78
78
  encoding: 'utf-8',
@@ -80,7 +80,7 @@ async function runSingleMigration(workspacePath, migration, configuration) {
80
80
  modifyMigrationsJsonMetadata(workspacePath, addSuccessfulMigration(migration.id, fileChanges.map((change) => ({
81
81
  path: change.path,
82
82
  type: change.type,
83
- })), gitRefAfter));
83
+ })), gitRefAfter, nextSteps));
84
84
  if (gitRefBefore !== gitRefAfter) {
85
85
  (0, child_process_1.execSync)('git add migrations.json', {
86
86
  cwd: workspacePath,
@@ -120,7 +120,7 @@ function modifyMigrationsJsonMetadata(workspacePath, modify) {
120
120
  migrationsJson['nx-console'] = modify(migrationsJson['nx-console']);
121
121
  (0, fs_1.writeFileSync)(migrationsJsonPath, JSON.stringify(migrationsJson, null, 2));
122
122
  }
123
- function addSuccessfulMigration(id, fileChanges, ref) {
123
+ function addSuccessfulMigration(id, fileChanges, ref, nextSteps) {
124
124
  return (migrationsJsonMetadata) => {
125
125
  const copied = { ...migrationsJsonMetadata };
126
126
  if (!copied.completedMigrations) {
@@ -133,6 +133,7 @@ function addSuccessfulMigration(id, fileChanges, ref) {
133
133
  name: id,
134
134
  changedFiles: fileChanges,
135
135
  ref,
136
+ nextSteps,
136
137
  },
137
138
  };
138
139
  return copied;
@@ -1,17 +1,18 @@
1
1
  import { NxReleaseConfiguration } from '../../config/nx-json';
2
2
  import { ChangelogOptions } from './command-object';
3
- import { NxReleaseConfig } from './config/config';
4
3
  import { Reference } from './utils/git';
5
4
  import { ReleaseVersion } from './utils/shared';
6
5
  export interface NxReleaseChangelogResult {
7
6
  workspaceChangelog?: {
8
7
  releaseVersion: ReleaseVersion;
9
8
  contents: string;
9
+ postGitTask: PostGitTask | null;
10
10
  };
11
11
  projectChangelogs?: {
12
12
  [projectName: string]: {
13
13
  releaseVersion: ReleaseVersion;
14
14
  contents: string;
15
+ postGitTask: PostGitTask | null;
15
16
  };
16
17
  };
17
18
  }
@@ -30,6 +31,6 @@ export interface ChangelogChange {
30
31
  shortHash?: string;
31
32
  revertedHashes?: string[];
32
33
  }
34
+ export type PostGitTask = (latestCommit: string) => Promise<void>;
33
35
  export declare const releaseChangelogCLIHandler: (args: ChangelogOptions) => Promise<number>;
34
36
  export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration): (args: ChangelogOptions) => Promise<NxReleaseChangelogResult>;
35
- export declare function shouldCreateGitHubRelease(changelogConfig: NxReleaseConfig['changelog']['workspaceChangelog'] | NxReleaseConfig['changelog']['projectChangelogs'] | NxReleaseConfig['groups'][number]['changelog'], createReleaseArg?: ChangelogOptions['createRelease'] | undefined): boolean;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseChangelogCLIHandler = void 0;
4
4
  exports.createAPI = createAPI;
5
- exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
6
5
  const chalk = require("chalk");
7
6
  const enquirer_1 = require("enquirer");
8
7
  const node_fs_1 = require("node:fs");
@@ -24,11 +23,11 @@ const filter_release_groups_1 = require("./config/filter-release-groups");
24
23
  const use_legacy_versioning_1 = require("./config/use-legacy-versioning");
25
24
  const version_plans_1 = require("./config/version-plans");
26
25
  const git_1 = require("./utils/git");
27
- const github_1 = require("./utils/github");
28
26
  const launch_editor_1 = require("./utils/launch-editor");
29
27
  const markdown_1 = require("./utils/markdown");
30
28
  const print_changes_1 = require("./utils/print-changes");
31
29
  const print_config_1 = require("./utils/print-config");
30
+ const remote_release_client_1 = require("./utils/remote-release-clients/remote-release-client");
32
31
  const resolve_changelog_renderer_1 = require("./utils/resolve-changelog-renderer");
33
32
  const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
34
33
  const shared_1 = require("./utils/shared");
@@ -226,21 +225,13 @@ function createAPI(overrideReleaseConfig) {
226
225
  const workspaceChangelog = await generateChangelogForWorkspace({
227
226
  tree,
228
227
  args,
229
- projectGraph,
230
228
  nxReleaseConfig,
231
229
  workspaceChangelogVersion,
232
230
  changes: workspaceChangelogChanges,
233
- // TODO(v22): remove this after the changelog renderer is refactored to remove coupling with git commits
234
- commits: filterHiddenCommits(workspaceChangelogCommits, nxReleaseConfig.conventionalCommits),
235
231
  });
236
- if (workspaceChangelog &&
237
- shouldCreateGitHubRelease(nxReleaseConfig.changelog.workspaceChangelog, args.createRelease)) {
238
- postGitTasks.push(async (latestCommit) => {
239
- output_1.output.logSingleLine(`Creating GitHub Release`);
240
- await (0, github_1.createOrUpdateGithubRelease)(nxReleaseConfig.changelog.workspaceChangelog
241
- ? nxReleaseConfig.changelog.workspaceChangelog.createRelease
242
- : config_1.defaultCreateReleaseProvider, workspaceChangelog.releaseVersion, workspaceChangelog.contents, latestCommit, { dryRun: args.dryRun });
243
- });
232
+ // Add the post git task (e.g. create a remote release) for the workspace changelog, if applicable
233
+ if (workspaceChangelog && workspaceChangelog.postGitTask) {
234
+ postGitTasks.push(workspaceChangelog.postGitTask);
244
235
  }
245
236
  /**
246
237
  * Compute any additional dependency bumps up front because there could be cases of circular dependencies,
@@ -381,17 +372,14 @@ function createAPI(overrideReleaseConfig) {
381
372
  nxReleaseConfig,
382
373
  projectToAdditionalDependencyBumps,
383
374
  });
384
- for (const [projectName, projectChangelog] of Object.entries(projectChangelogs)) {
385
- if (projectChangelogs &&
386
- shouldCreateGitHubRelease(releaseGroup.changelog, args.createRelease)) {
387
- postGitTasks.push(async (latestCommit) => {
388
- output_1.output.logSingleLine(`Creating GitHub Release`);
389
- await (0, github_1.createOrUpdateGithubRelease)(releaseGroup.changelog
390
- ? releaseGroup.changelog.createRelease
391
- : config_1.defaultCreateReleaseProvider, projectChangelog.releaseVersion, projectChangelog.contents, latestCommit, { dryRun: args.dryRun });
392
- });
375
+ if (projectChangelogs) {
376
+ for (const [projectName, projectChangelog] of Object.entries(projectChangelogs)) {
377
+ // Add the post git task (e.g. create a remote release) for the project changelog, if applicable
378
+ if (projectChangelog.postGitTask) {
379
+ postGitTasks.push(projectChangelog.postGitTask);
380
+ }
381
+ allProjectChangelogs[projectName] = projectChangelog;
393
382
  }
394
- allProjectChangelogs[projectName] = projectChangelog;
395
383
  }
396
384
  }
397
385
  }
@@ -486,17 +474,14 @@ function createAPI(overrideReleaseConfig) {
486
474
  nxReleaseConfig,
487
475
  projectToAdditionalDependencyBumps,
488
476
  });
489
- for (const [projectName, projectChangelog] of Object.entries(projectChangelogs)) {
490
- if (projectChangelogs &&
491
- shouldCreateGitHubRelease(releaseGroup.changelog, args.createRelease)) {
492
- postGitTasks.push(async (latestCommit) => {
493
- output_1.output.logSingleLine(`Creating GitHub Release`);
494
- await (0, github_1.createOrUpdateGithubRelease)(releaseGroup.changelog
495
- ? releaseGroup.changelog.createRelease
496
- : config_1.defaultCreateReleaseProvider, projectChangelog.releaseVersion, projectChangelog.contents, latestCommit, { dryRun: args.dryRun });
497
- });
477
+ if (projectChangelogs) {
478
+ for (const [projectName, projectChangelog] of Object.entries(projectChangelogs)) {
479
+ // Add the post git task (e.g. create a remote release) for the project changelog, if applicable
480
+ if (projectChangelog.postGitTask) {
481
+ postGitTasks.push(projectChangelog.postGitTask);
482
+ }
483
+ allProjectChangelogs[projectName] = projectChangelog;
498
484
  }
499
- allProjectChangelogs[projectName] = projectChangelog;
500
485
  }
501
486
  }
502
487
  }
@@ -546,6 +531,19 @@ function resolveChangelogVersions(args, releaseGroups, releaseGroupToFilteredPro
546
531
  projectsVersionData: versionData,
547
532
  };
548
533
  }
534
+ // Can be overridden to something more specific as we resolve the remote release client within nested logic
535
+ let remoteReleaseProviderName;
536
+ // If already set, and not the same as the remote release client, append
537
+ function applyRemoteReleaseProviderName(newRemoteReleaseProviderName) {
538
+ if (remoteReleaseProviderName) {
539
+ if (remoteReleaseProviderName !== newRemoteReleaseProviderName) {
540
+ remoteReleaseProviderName = `${remoteReleaseProviderName}/${newRemoteReleaseProviderName}`;
541
+ }
542
+ }
543
+ else {
544
+ remoteReleaseProviderName = newRemoteReleaseProviderName;
545
+ }
546
+ }
549
547
  async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTasks, commitMessageValues, gitTagValues, releaseGroups) {
550
548
  let latestCommit = toSHA;
551
549
  const changes = tree.listChanges();
@@ -563,19 +561,21 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
563
561
  ],
564
562
  });
565
563
  if (!postGitTasks.length) {
566
- // no GitHub releases to create so we can just exit
564
+ // No post git tasks (e.g. remote release creation) to perform so we can just exit
567
565
  return;
568
566
  }
569
567
  if ((0, is_ci_1.isCI)()) {
570
568
  output_1.output.warn({
571
- title: `Skipped GitHub release creation because no changes were detected for any changelog files.`,
569
+ title: `Skipped ${remoteReleaseProviderName ?? 'remote'} release creation because no changes were detected for any changelog files.`,
572
570
  });
573
571
  return;
574
572
  }
575
- // prompt the user to see if they want to create a GitHub release anyway
576
- // we know that the user has configured GitHub releases because we have postGitTasks
577
- const shouldCreateGitHubReleaseAnyway = await promptForGitHubRelease();
578
- if (!shouldCreateGitHubReleaseAnyway) {
573
+ /**
574
+ * Prompt the user to see if they want to create a remote release anyway.
575
+ * We know that the user has configured remote releases because we have postGitTasks.
576
+ */
577
+ const shouldCreateRemoteReleaseAnyway = await promptForRemoteRelease();
578
+ if (!shouldCreateRemoteReleaseAnyway) {
579
579
  return;
580
580
  }
581
581
  for (const postGitTask of postGitTasks) {
@@ -658,7 +658,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
658
658
  }
659
659
  return;
660
660
  }
661
- async function generateChangelogForWorkspace({ tree, args, projectGraph, nxReleaseConfig, workspaceChangelogVersion, changes, commits, }) {
661
+ async function generateChangelogForWorkspace({ tree, args, nxReleaseConfig, workspaceChangelogVersion, changes, }) {
662
662
  const config = nxReleaseConfig.changelog.workspaceChangelog;
663
663
  // The entire feature is disabled at the workspace level, exit early
664
664
  if (config === false) {
@@ -716,16 +716,17 @@ async function generateChangelogForWorkspace({ tree, args, projectGraph, nxRelea
716
716
  title: `${prefix} an entry in ${interpolatedTreePath} for ${chalk.white(releaseVersion.gitTag)}`,
717
717
  });
718
718
  }
719
- const githubRepoData = (0, github_1.getGitHubRepoData)(gitRemote, config.createRelease);
719
+ const remoteReleaseClient = await (0, remote_release_client_1.createRemoteReleaseClient)(config.createRelease, gitRemote);
720
+ applyRemoteReleaseProviderName(remoteReleaseClient.remoteReleaseProviderName);
720
721
  const changelogRenderer = new ChangelogRendererClass({
721
722
  changes,
722
723
  changelogEntryVersion: releaseVersion.rawVersion,
723
724
  project: null,
724
725
  isVersionPlans: false,
725
- repoData: githubRepoData,
726
726
  entryWhenNoChanges: config.entryWhenNoChanges,
727
727
  changelogRenderOptions: config.renderOptions,
728
728
  conventionalCommitsConfig: nxReleaseConfig.conventionalCommits,
729
+ remoteReleaseClient,
729
730
  });
730
731
  let contents = await changelogRenderer.render();
731
732
  /**
@@ -764,9 +765,13 @@ async function generateChangelogForWorkspace({ tree, args, projectGraph, nxRelea
764
765
  tree.write(interpolatedTreePath, rootChangelogContents);
765
766
  (0, print_changes_1.printAndFlushChanges)(tree, !!dryRun, 3, false, shared_1.noDiffInChangelogMessage);
766
767
  }
768
+ const postGitTask = args.createRelease !== false && config.createRelease
769
+ ? remoteReleaseClient.createPostGitTask(releaseVersion, contents, dryRun)
770
+ : null;
767
771
  return {
768
772
  releaseVersion,
769
773
  contents,
774
+ postGitTask,
770
775
  };
771
776
  }
772
777
  async function generateChangelogForProjects({ tree, args, changes, projectsVersionData, releaseGroup, projects, nxReleaseConfig, projectToAdditionalDependencyBumps, }) {
@@ -780,6 +785,9 @@ async function generateChangelogForProjects({ tree, args, changes, projectsVersi
780
785
  const dryRun = !!args.dryRun;
781
786
  const gitRemote = args.gitRemote;
782
787
  const ChangelogRendererClass = (0, resolve_changelog_renderer_1.resolveChangelogRenderer)(config.renderer);
788
+ // Maximum of one remote release client per release group
789
+ const remoteReleaseClient = await (0, remote_release_client_1.createRemoteReleaseClient)(config.createRelease, gitRemote);
790
+ applyRemoteReleaseProviderName(remoteReleaseClient.remoteReleaseProviderName);
783
791
  const projectChangelogs = {};
784
792
  for (const project of projects) {
785
793
  let interpolatedTreePath = config.file || '';
@@ -809,12 +817,10 @@ async function generateChangelogForProjects({ tree, args, changes, projectsVersi
809
817
  title: `${prefix} an entry in ${interpolatedTreePath} for ${chalk.white(releaseVersion.gitTag)}`,
810
818
  });
811
819
  }
812
- const githubRepoData = (0, github_1.getGitHubRepoData)(gitRemote, config.createRelease);
813
820
  const changelogRenderer = new ChangelogRendererClass({
814
821
  changes,
815
822
  changelogEntryVersion: releaseVersion.rawVersion,
816
823
  project: project.name,
817
- repoData: githubRepoData,
818
824
  entryWhenNoChanges: typeof config.entryWhenNoChanges === 'string'
819
825
  ? (0, utils_1.interpolate)(config.entryWhenNoChanges, {
820
826
  projectName: project.name,
@@ -828,6 +834,7 @@ async function generateChangelogForProjects({ tree, args, changes, projectsVersi
828
834
  ? null
829
835
  : nxReleaseConfig.conventionalCommits,
830
836
  dependencyBumps: projectToAdditionalDependencyBumps.get(project.name),
837
+ remoteReleaseClient,
831
838
  });
832
839
  let contents = await changelogRenderer.render();
833
840
  /**
@@ -868,9 +875,13 @@ async function generateChangelogForProjects({ tree, args, changes, projectsVersi
868
875
  // Only print the change for the current changelog file at this point
869
876
  (f) => f.path === interpolatedTreePath);
870
877
  }
878
+ const postGitTask = args.createRelease !== false && config.createRelease
879
+ ? remoteReleaseClient.createPostGitTask(releaseVersion, contents, dryRun)
880
+ : null;
871
881
  projectChangelogs[project.name] = {
872
882
  releaseVersion,
873
883
  contents,
884
+ postGitTask,
874
885
  };
875
886
  }
876
887
  return projectChangelogs;
@@ -903,36 +914,12 @@ function filterHiddenChanges(changes, conventionalCommitsConfig) {
903
914
  return !typeConfig.changelog.hidden;
904
915
  });
905
916
  }
906
- // TODO(v22): remove this after the changelog renderer is refactored to remove coupling with git commits
907
- function filterHiddenCommits(commits, conventionalCommitsConfig) {
908
- if (!commits) {
909
- return [];
910
- }
911
- return commits.filter((commit) => {
912
- const type = commit.type;
913
- const typeConfig = conventionalCommitsConfig.types[type];
914
- if (!typeConfig) {
915
- // don't include commits with unknown types
916
- return false;
917
- }
918
- return !typeConfig.changelog.hidden;
919
- });
920
- }
921
- function shouldCreateGitHubRelease(changelogConfig, createReleaseArg = undefined) {
922
- if (createReleaseArg !== undefined) {
923
- return createReleaseArg === 'github';
924
- }
925
- if (changelogConfig === false) {
926
- return false;
927
- }
928
- return changelogConfig.createRelease !== false;
929
- }
930
- async function promptForGitHubRelease() {
917
+ async function promptForRemoteRelease() {
931
918
  try {
932
919
  const result = await (0, enquirer_1.prompt)([
933
920
  {
934
921
  name: 'confirmation',
935
- message: 'Do you want to create a GitHub release anyway?',
922
+ message: `Do you want to create a ${remoteReleaseProviderName ?? 'remote'} release anyway?`,
936
923
  type: 'confirm',
937
924
  },
938
925
  ]);
@@ -40,7 +40,7 @@ export type ChangelogOptions = NxReleaseArgs & GitOptions & VersionPlanArgs & Fi
40
40
  to?: string;
41
41
  from?: string;
42
42
  interactive?: string;
43
- createRelease?: false | 'github';
43
+ createRelease?: false | 'github' | 'gitlab';
44
44
  };
45
45
  export type PublishOptions = NxReleaseArgs & Partial<RunManyOptions> & {
46
46
  outputStyle?: OutputStyle;
@@ -51,5 +51,12 @@ export declare function createNxReleaseConfig(projectGraph: ProjectGraph, projec
51
51
  nxReleaseConfig: NxReleaseConfig | null;
52
52
  }>;
53
53
  export declare function handleNxReleaseConfigError(error: CreateNxReleaseConfigError, useLegacyVersioning: boolean): Promise<never>;
54
- export declare const defaultCreateReleaseProvider: any;
54
+ /**
55
+ * Full form of the createRelease config, with the provider, hostname, and apiBaseUrl resolved.
56
+ */
57
+ export interface ResolvedCreateRemoteReleaseProvider {
58
+ provider: string;
59
+ hostname: string;
60
+ apiBaseUrl: string;
61
+ }
55
62
  export {};