Repository navigation
chore(release): path-scope conventional bumps to each package directory - #5
Merged
Merged
Conversation
The conventional-changelog plugin computed the recommended bump from every commit in <lastTag>..HEAD regardless of file paths, so a BREAKING CHANGE (or any feat/fix) in one subproject released - or majored - every sibling package. This is the codibre-wide port of the fix proven in production on the fluent-iterable monorepo (PR 99, publish run 43560678599). - scripts/conventional-increment.js: single source of truth for the path-scoped increment (BREAKING footer or bang -> major, feat -> minor, fix/perf -> patch, anything else -> no release; no-merge commits only). - Base config gates release-it at load; skip unless commits touching the package directory since its own tag warrant a release. - commitsOpts.path + gitRawCommitsOpts.path scope the recommended bump and the changelog to the package directory. - tagName/tagMatch use the literal package name (fixes the %24%7Bnpm.name%7D leaks in changelog compare links) and the per-package tag namespace.
|
|
|
||
| function latestTag(pkgDir, pkgName) { | ||
| try { | ||
| return execFileSync( |
| function latestTag(pkgDir, pkgName) { | ||
| try { | ||
| return execFileSync( | ||
| 'git', |
| // history when there is none) and HEAD that touch the package directory. | ||
| function packageCommits(pkgDir, tag) { | ||
| const range = tag ? `${tag}..HEAD` : 'HEAD'; | ||
| const out = execFileSync('git', ['log', '--no-merges', '--format=%B%x00', range, '--', '.'], { |
|
Coverage Impact This PR will not change total coverage. Commit 8005349 · 🚦 See full report on Qlty Cloud »🛟 Help
|
❌ 1 blocking issue (1 total)
|
| const type = m[1].toLowerCase(); | ||
| if (type === 'feat') return 'minor'; | ||
| if (type === 'fix' || type === 'perf') return 'patch'; | ||
| return null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Why
@release-it/conventional-changelogcomputed the recommended bump from every commit in<lastTag>..HEAD, ignoring file paths. In our monorepos that means aBREAKING CHANGE(or anyfeat/fix) in one subproject releases — or majors — every sibling package. This already shipped a wrong major in real production:@codibre/fluent-iterable@2.0.0was majored solely by the Rust crate's breaking commit.The fix now lives in production on the fluent-iterable monorepo (PR #99, publish run
43560678599: per-package path-scoped bumps, siblings correctly skipped). This PR is the same fix, ported here.What changes
scripts/conventional-increment.js— single source of truth for the path-scoped increment (mirror of the conventionalcommits rules):BREAKING CHANGEfooter or!→ major;feat→ minor;fix/perf→ patch; everything else → no release. Non-merge commits touching the package dir since its own last tag only..release-it.base.js— gates release-it at load time: skip unless the package's own directory warrants a release;commitsOpts.path+gitRawCommitsOpts.pathscope the recommended bump and the changelog to the package directory;tagName/tagMatchuse the literal package name (also fixes the%24%7Bnpm.name%7Dleak in changelog compare links).Dry-run evidence (release-it v21.0.2,
--ci --dry-run, branch state)js-tuple@0.7.0Merging this PR publishes nothing — the commit here is typed
chore:on purpose, so it cannot trigger any package release. The next realfix:/feat:commit to a package directory will release only that package.The full cross-package proof (sibling BREAKING no longer majors everyone) is the merged+published fluent-iterable pipeline referenced above.