feat(release)!: refactor releaseTag* properties to a releaseTag object#33020
feat(release)!: refactor releaseTag* properties to a releaseTag object#33020
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
7a409fa to
2f45383
Compare
2f45383 to
e5ae7b4
Compare
|
View your CI Pipeline Execution ↗ for commit e04ea45
☁️ Nx Cloud last updated this comment at |
e5ae7b4 to
b3ff992
Compare
b3ff992 to
e2cb8f1
Compare
Consolidate 5 separate releaseTag* properties into a single nested releaseTag object: - releaseTagPattern → releaseTag.pattern - releaseTagPatternCheckAllBranchesWhen → releaseTag.checkAllBranchesWhen - releaseTagPatternRequireSemver → releaseTag.requireSemver - releaseTagPatternPreferDockerVersion → releaseTag.preferDockerVersion - releaseTagPatternStrictPreid → releaseTag.strictPreid Updated NxReleaseConfiguration interface and NxReleaseConfig type to support the new structure. Old properties are deprecated but still supported for backward compatibility. BREAKING CHANGE: This changes the preferred configuration structure for release tags. The old flat structure is deprecated and will be removed in Nx 23. feat(nx): update config handling to use nested releaseTag structure Updated default value processing and group configuration in config.ts: - Modified WORKSPACE_DEFAULTS and GROUP_DEFAULTS to use releaseTag object - Added backward compatibility by checking both new and deprecated properties - Updated docker project inference logic to use releaseTag.requireSemver and releaseTag.preferDockerVersion - All configuration merging now handles both old flat and new nested formats Changes maintain full backward compatibility - old flat structure still works during migration period. feat(nx): update consumers to use nested releaseTag structure - Update git.ts: Rename GetLatestGitTagForPatternOptions properties to use simplified names (requireSemver, strictPreid) - Update shared.ts: Change all releaseGroup.releaseTagPattern references to releaseGroup.releaseTag.pattern and releaseTagPatternPreferDockerVersion to releaseTag.preferDockerVersion - Update changelog.ts: Update all getLatestGitTagForPattern calls to use new nested structure and update error messages - Update release-group-processor.ts: Change releaseGroup property access to use nested releaseTag structure - Add new releaseTag nested object property with pattern, checkAllBranchesWhen, requireSemver, preferDockerVersion, and strictPreid sub-properties - Mark old flat properties (releaseTagPattern, releaseTagPatternCheckAllBranchesWhen, etc.) as deprecated with x-deprecated annotations - Apply changes to both root release configuration and release groups configuration - Maintain backward compatibility by keeping deprecated properties in schema feat(nx): add migration to consolidate releaseTag* config - Create migration that transforms old flat releaseTag* properties to new nested releaseTag object structure - Handle migrations for nx.json (root and groups), project.json, and package.json - Preserve new format when both old and new properties exist (new takes precedence) - Include comprehensive test coverage for migration scenarios - Register migration in migrations.json as "22-0-0-consolidate-release-tag-config" test(nx): update test fixtures to use nested releaseTag structure - Update shared.spec.ts: Convert all releaseTagPattern* properties to nested releaseTag object - Update git.spec.ts: Change releaseTagPatternRequireSemver/StrictPreid to requireSemver/strictPreid - Update config.spec.ts: Update all snapshot expectations to use nested structure - Update filter-release-groups.spec.ts: Update mock release group fixtures - Update version-plan-utils.spec.ts: Update mock release group setup All test fixtures now match the new nested releaseTag configuration format. fix(release): remove deprecated releaseTagPattern properties from group type Add RemoveDeprecatedPropertiesFromEach type utility to ensure deprecated properties are removed from group types in NxReleaseConfig. This prevents type errors when the deprecated flat properties are no longer present in the runtime objects after the configuration normalization. fix(release): remove deprecated releaseTagPattern properties from group type Add RemoveDeprecatedPropertiesFromEach type utility to ensure deprecated properties are removed from group types in NxReleaseConfig. This prevents type errors when the deprecated flat properties are no longer present in the runtime objects after the configuration normalization.
e2cb8f1 to
a208915
Compare
There was a problem hiding this comment.
Nx Cloud is proposing a fix for your failed CI:
We've identified and fixed a missed test update. The PR updated error messages to reference the new nested configuration path "release.releaseTag.pattern", and while two tests were updated accordingly, one test on line 318 was missed. This change updates that test to match the new error message format, which will resolve the TypeError.
We verified this fix by re-running e2e-release:e2e-ci--src/first-release.test.ts.
diff --git a/e2e/release/src/first-release.test.ts b/e2e/release/src/first-release.test.ts
index 0f1823ca5c..0da1412576 100644
--- a/e2e/release/src/first-release.test.ts
+++ b/e2e/release/src/first-release.test.ts
@@ -315,7 +315,7 @@ describe('nx release first run', () => {
expect(
releaseOutput3.match(
new RegExp(
- `NX Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTagPattern" property in nx.json to match the structure of your repository's git tags.`,
+ `NX Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTag.pattern" property in nx.json to match the structure of your repository's git tags.`,
'g'
)
).length
✅ The fix was applied to this branch.
View interactive diff ↗
🎓 To learn more about Self Healing CI, please visit nx.dev
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
The Nx release configuration currently uses 5 separate flat properties for release tag
configuration:
releaseTagPatternreleaseTagPatternCheckAllBranchesWhenreleaseTagPatternRequireSemverreleaseTagPatternPreferDockerVersionreleaseTagPatternStrictPreidThis flat structure makes the configuration verbose and harder to organize, especially
as more release tag options are added.
Example of current configuration:
{ "release": { "releaseTagPattern": "{projectName}@{version}", "releaseTagPatternRequireSemver": true, "releaseTagPatternStrictPreid": false } }Expected Behavior
After this PR, all release tag-related configuration is consolidated into a single
nested releaseTag object with the following structure:
Example of new configuration:
Migration & Backward Compatibility:
BREAKING CHANGE: This is a breaking change in the preferred configuration structure. Existing configurations will continue to work through the migration period, but users should update to the new nested format.