From 9e6c7fa6e303acf20835e29c1dfe4ecd549a0111 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 29 Jul 2024 20:31:43 +0400 Subject: [PATCH] Revert "feat(release): allow {releaseGroupName} to be interpolated in releaseTagPattern" (#27189) Reverts nrwl/nx#27188 --- .../nx-release/get-started-with-nx-release.md | 2 - .../recipes/nx-release/publish-rust-crates.md | 2 - docs/shared/reference/nx-json.md | 2 +- .../nx/src/command-line/release/changelog.ts | 1 - .../release/config/config.spec.ts | 361 ------------------ .../src/command-line/release/config/config.ts | 4 - .../src/command-line/release/utils/shared.ts | 1 - 7 files changed, 1 insertion(+), 372 deletions(-) diff --git a/docs/shared/recipes/nx-release/get-started-with-nx-release.md b/docs/shared/recipes/nx-release/get-started-with-nx-release.md index 0c703f7d38cb4..a0a2cb48f380e 100644 --- a/docs/shared/recipes/nx-release/get-started-with-nx-release.md +++ b/docs/shared/recipes/nx-release/get-started-with-nx-release.md @@ -270,8 +270,6 @@ For this same example, if you want the commit message to be 'chore(release): 1.2 } ``` -When using release groups in which the member projects are versioned together, you can also leverage `{releaseGroupName}` and it will be interpolated appropriately in the commit/tag that gets created for that release group. - ## Future Releases After the first release, the `--first-release` option will no longer be required. Nx Release will expect to find git tags and changelog files for each package. It will also use `npm view` to look up the current version of packages before publishing, ensuring that the package has not already been published and therefore avoid any conflict errors, meaning you can run the same publish action multiple times without any negative side-effects. diff --git a/docs/shared/recipes/nx-release/publish-rust-crates.md b/docs/shared/recipes/nx-release/publish-rust-crates.md index 2d959adb51ea6..30988f2df6227 100644 --- a/docs/shared/recipes/nx-release/publish-rust-crates.md +++ b/docs/shared/recipes/nx-release/publish-rust-crates.md @@ -209,8 +209,6 @@ For this same example, if you want the commit message to be 'chore(release): 1.2 } ``` -When using release groups in which the member projects are versioned together, you can also leverage `{releaseGroupName}` and it will be interpolated appropriately in the commit/tag that gets created for that release group. - ## Future Releases After the first release, the `--first-release` option will no longer be required. Nx Release will expect to find git tags and changelog files for each package. diff --git a/docs/shared/reference/nx-json.md b/docs/shared/reference/nx-json.md index 1ba234a44229d..d8b1d4ac6ef30 100644 --- a/docs/shared/reference/nx-json.md +++ b/docs/shared/reference/nx-json.md @@ -347,7 +347,7 @@ The `projectsRelationship` property tells Nx whether to release projects indepen Optionally override the git/release tag pattern to use. This field is the source of truth for changelog generation and release tagging, as well as for conventional commits parsing. -It supports interpolating the version as `{version}` and (if releasing independently or forcing project level version control system releases) the project name as `{projectName}` within the string. When using release groups in which the member projects are versioned together, you can also leverage `{releaseGroupName}` and it will be interpolated appropriately in the commit/tag that gets created for that release group. +It supports interpolating the version as `{version}` and (if releasing independently or forcing project level version control system releases) the project name as `{projectName}` within the string. The default `"releaseTagPattern"` for fixed/unified releases is: `v{version}` diff --git a/packages/nx/src/command-line/release/changelog.ts b/packages/nx/src/command-line/release/changelog.ts index 967b0e162a6f5..344f9faf48b2e 100644 --- a/packages/nx/src/command-line/release/changelog.ts +++ b/packages/nx/src/command-line/release/changelog.ts @@ -497,7 +497,6 @@ export async function releaseChangelog( ( await getLatestGitTagForPattern(releaseGroup.releaseTagPattern, { projectName: project.name, - releaseGroupName: releaseGroup.name, }) )?.tag; diff --git a/packages/nx/src/command-line/release/config/config.spec.ts b/packages/nx/src/command-line/release/config/config.spec.ts index 0d23d98da9b7c..8790a38c5cab8 100644 --- a/packages/nx/src/command-line/release/config/config.spec.ts +++ b/packages/nx/src/command-line/release/config/config.spec.ts @@ -6709,367 +6709,6 @@ describe('createNxReleaseConfig()', () => { }); }); - describe('default releaseTagPatterns', () => { - it('should have a default pattern of v{version}', async () => { - const res = await createNxReleaseConfig(projectGraph, projectFileMap, {}); - expect(res).toMatchInlineSnapshot(` - { - "error": null, - "nxReleaseConfig": { - "changelog": { - "automaticFromRef": false, - "git": { - "commit": true, - "commitArgs": "", - "commitMessage": "chore(release): publish {version}", - "stageChanges": false, - "tag": true, - "tagArgs": "", - "tagMessage": "", - }, - "projectChangelogs": false, - "workspaceChangelog": { - "createRelease": false, - "entryWhenNoChanges": "This was a version bump only, there were no code changes.", - "file": "{workspaceRoot}/CHANGELOG.md", - "renderOptions": { - "authors": true, - "commitReferences": true, - "mapAuthorsToGitHubUsernames": true, - "versionTitleDate": true, - }, - "renderer": "/release/changelog-renderer", - }, - }, - "conventionalCommits": { - "types": { - "build": { - "changelog": { - "hidden": true, - "title": "📦 Build", - }, - "semverBump": "none", - }, - "chore": { - "changelog": { - "hidden": true, - "title": "🏡 Chore", - }, - "semverBump": "none", - }, - "ci": { - "changelog": { - "hidden": true, - "title": "🤖 CI", - }, - "semverBump": "none", - }, - "docs": { - "changelog": { - "hidden": true, - "title": "📖 Documentation", - }, - "semverBump": "none", - }, - "examples": { - "changelog": { - "hidden": true, - "title": "🏀 Examples", - }, - "semverBump": "none", - }, - "feat": { - "changelog": { - "hidden": false, - "title": "🚀 Features", - }, - "semverBump": "minor", - }, - "fix": { - "changelog": { - "hidden": false, - "title": "🩹 Fixes", - }, - "semverBump": "patch", - }, - "perf": { - "changelog": { - "hidden": false, - "title": "🔥 Performance", - }, - "semverBump": "none", - }, - "refactor": { - "changelog": { - "hidden": true, - "title": "💅 Refactors", - }, - "semverBump": "none", - }, - "revert": { - "changelog": { - "hidden": true, - "title": "⏪ Revert", - }, - "semverBump": "none", - }, - "style": { - "changelog": { - "hidden": true, - "title": "🎨 Styles", - }, - "semverBump": "none", - }, - "test": { - "changelog": { - "hidden": true, - "title": "✅ Tests", - }, - "semverBump": "none", - }, - "types": { - "changelog": { - "hidden": true, - "title": "🌊 Types", - }, - "semverBump": "none", - }, - }, - }, - "git": { - "commit": false, - "commitArgs": "", - "commitMessage": "chore(release): publish {version}", - "stageChanges": false, - "tag": false, - "tagArgs": "", - "tagMessage": "", - }, - "groups": { - "__default__": { - "changelog": false, - "projects": [ - "lib-a", - "lib-b", - "nx", - ], - "projectsRelationship": "fixed", - "releaseTagPattern": "v{version}", - "version": { - "conventionalCommits": false, - "generator": "@nx/js:release-version", - "generatorOptions": {}, - }, - "versionPlans": false, - }, - }, - "projectsRelationship": "fixed", - "releaseTagPattern": "v{version}", - "version": { - "conventionalCommits": false, - "generator": "@nx/js:release-version", - "generatorOptions": {}, - "git": { - "commit": false, - "commitArgs": "", - "commitMessage": "chore(release): publish {version}", - "stageChanges": true, - "tag": false, - "tagArgs": "", - "tagMessage": "", - }, - "preVersionCommand": "", - }, - "versionPlans": false, - }, - } - `); - }); - - /** - * TODO: make this the default behavior in v20 (it's a breaking change) - */ - it.skip('should have a default pattern of {releaseGroupName}-v{version} when one or more custom release groups are used', async () => { - const res = await createNxReleaseConfig(projectGraph, projectFileMap, { - groups: { - 'group-1': { - projects: 'lib-a', - }, - }, - }); - expect(res).toMatchInlineSnapshot(` - { - "error": null, - "nxReleaseConfig": { - "changelog": { - "automaticFromRef": false, - "git": { - "commit": true, - "commitArgs": "", - "commitMessage": "chore(release): publish {version}", - "stageChanges": false, - "tag": true, - "tagArgs": "", - "tagMessage": "", - }, - "projectChangelogs": false, - "workspaceChangelog": { - "createRelease": false, - "entryWhenNoChanges": "This was a version bump only, there were no code changes.", - "file": "{workspaceRoot}/CHANGELOG.md", - "renderOptions": { - "authors": true, - "commitReferences": true, - "mapAuthorsToGitHubUsernames": true, - "versionTitleDate": true, - }, - "renderer": "/release/changelog-renderer", - }, - }, - "conventionalCommits": { - "types": { - "build": { - "changelog": { - "hidden": true, - "title": "📦 Build", - }, - "semverBump": "none", - }, - "chore": { - "changelog": { - "hidden": true, - "title": "🏡 Chore", - }, - "semverBump": "none", - }, - "ci": { - "changelog": { - "hidden": true, - "title": "🤖 CI", - }, - "semverBump": "none", - }, - "docs": { - "changelog": { - "hidden": true, - "title": "📖 Documentation", - }, - "semverBump": "none", - }, - "examples": { - "changelog": { - "hidden": true, - "title": "🏀 Examples", - }, - "semverBump": "none", - }, - "feat": { - "changelog": { - "hidden": false, - "title": "🚀 Features", - }, - "semverBump": "minor", - }, - "fix": { - "changelog": { - "hidden": false, - "title": "🩹 Fixes", - }, - "semverBump": "patch", - }, - "perf": { - "changelog": { - "hidden": false, - "title": "🔥 Performance", - }, - "semverBump": "none", - }, - "refactor": { - "changelog": { - "hidden": true, - "title": "💅 Refactors", - }, - "semverBump": "none", - }, - "revert": { - "changelog": { - "hidden": true, - "title": "⏪ Revert", - }, - "semverBump": "none", - }, - "style": { - "changelog": { - "hidden": true, - "title": "🎨 Styles", - }, - "semverBump": "none", - }, - "test": { - "changelog": { - "hidden": true, - "title": "✅ Tests", - }, - "semverBump": "none", - }, - "types": { - "changelog": { - "hidden": true, - "title": "🌊 Types", - }, - "semverBump": "none", - }, - }, - }, - "git": { - "commit": false, - "commitArgs": "", - "commitMessage": "chore(release): publish {version}", - "stageChanges": false, - "tag": false, - "tagArgs": "", - "tagMessage": "", - }, - "groups": { - "group-1": { - "changelog": false, - "projects": [ - "lib-a", - ], - "projectsRelationship": "fixed", - "releaseTagPattern": "{releaseGroupName}-v{version}", - "version": { - "conventionalCommits": false, - "generator": "@nx/js:release-version", - "generatorOptions": {}, - }, - "versionPlans": false, - }, - }, - "projectsRelationship": "fixed", - "releaseTagPattern": "{releaseGroupName}-v{version}", - "version": { - "conventionalCommits": false, - "generator": "@nx/js:release-version", - "generatorOptions": {}, - "git": { - "commit": false, - "commitArgs": "", - "commitMessage": "chore(release): publish {version}", - "stageChanges": true, - "tag": false, - "tagArgs": "", - "tagMessage": "", - }, - "preVersionCommand": "", - }, - "versionPlans": false, - }, - } - `); - }); - }); - describe('projectsRelationship at the root', () => { it('should respect the user specified projectsRelationship value and apply it to any groups that do not specify their own value', async () => { const res = await createNxReleaseConfig(projectGraph, projectFileMap, { diff --git a/packages/nx/src/command-line/release/config/config.ts b/packages/nx/src/command-line/release/config/config.ts index 1de7b09865236..b865d4cd154ff 100644 --- a/packages/nx/src/command-line/release/config/config.ts +++ b/packages/nx/src/command-line/release/config/config.ts @@ -173,10 +173,6 @@ export async function createNxReleaseConfig( }; const defaultFixedReleaseTagPattern = 'v{version}'; - /** - * TODO: in v20, make it so that this pattern is used by default when any custom groups are used - */ - const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}'; const defaultIndependentReleaseTagPattern = '{projectName}@{version}'; const workspaceProjectsRelationship = diff --git a/packages/nx/src/command-line/release/utils/shared.ts b/packages/nx/src/command-line/release/utils/shared.ts index 4ef8018f32969..a75a1c5e42383 100644 --- a/packages/nx/src/command-line/release/utils/shared.ts +++ b/packages/nx/src/command-line/release/utils/shared.ts @@ -269,7 +269,6 @@ export function createGitTagValues( tags.push( interpolate(releaseGroup.releaseTagPattern, { version: projectVersionData.newVersion, - releaseGroupName: releaseGroup.name, }) ); }