Skip to content

chore(release): path-scope conventional bumps to each package directory - #5

Merged
Farenheith merged 1 commit into
mainfrom
fix/per-package-release-bump
Nov 14, 2026
Merged

Farenheith merged 1 commit into
mainfrom
fix/per-package-release-bump

Conversation

@Farenheith

Copy link
Copy Markdown
Member

Why

@release-it/conventional-changelog computed the recommended bump from every commit in <lastTag>..HEAD, ignoring file paths. In our monorepos that means a BREAKING CHANGE (or any feat/fix) in one subproject releases — or majors — every sibling package. This already shipped a wrong major in real production: @codibre/fluent-iterable@2.0.0 was 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 CHANGE footer 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.path scope the recommended bump and the changelog to the package directory; tagName/tagMatch use the literal package name (also fixes the %24%7Bnpm.name%7D leak in changelog compare links).

Dry-run evidence (release-it v21.0.2, --ci --dry-run, branch state)

Package Decision
js-tuple ⏭️ skip — no feat/fix/perf/BREAKING touching its dir since js-tuple@0.7.0

Merging this PR publishes nothing — the commit here is typed chore: on purpose, so it cannot trigger any package release. The next real fix:/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.

⚠️ Merge strategy note: keep per-package release commits meaningful — don't squash-merge PRs that carry package changes in this repo (same rule as fluent-iterable).

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.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE


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, '--', '.'], {
@qltysh

qltysh Bot commented Nov 14, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Commit 8005349 · 🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh

qltysh Bot commented Nov 14, 2026

Copy link
Copy Markdown

❌ 1 blocking issue (1 total)

Tool Category Rule Count
qlty Structure Function with many returns (count = 6): classifyMessage 1 ❌

const type = m[1].toLowerCase();
if (type === 'feat') return 'minor';
if (type === 'fix' || type === 'perf') return 'patch';
return null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many returns (count = 6): classifyMessage [qlty:return-statements]

@Farenheith
Farenheith merged commit 5a92872 into main Nov 14, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants