fix: detect changes to the root package in single-package repos#125
Merged
Conversation
|
The changes in this PR will be included in the next version bump.
|
findChangedPackages matched changed files against pkgRelDir + '/', but the
root package has an empty relative dir, making the check file.startsWith('/')
which never matches git's relative paths. ci check therefore always reported
'No managed packages have changed' in non-monorepo repos. The root package now
treats every changed file as its own (still honoring changedFilePatterns).
mapFilesToPackages had the same empty-pkgRelDir bug as findChangedPackages:
file.startsWith('/') never matches, so 'bumpy generate' never attributed
commits to the root package in single-package repos. Export it and cover both
single-package and monorepo cases with a test.
90b6442 to
4999ea4
Compare
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.


Problem
In a single-package (non-monorepo) repo,
bumpy ci checkalways reported "No managed packages have changed — no bump files needed." and never posted a PR comment — even when source files clearly changed.Reported via a fresh setup in dmno-dev/fledgling (failing run). The repo was not misconfigured.
Root cause
Changed files were matched against the package directory like so:
For the root package of a single-package repo,
pkg.dir === rootDir, sopkgRelDir === ''and the test becomesfile.startsWith('/')— always false for git's relative paths (src/cli.ts, etc.). The root package therefore never matched any changed file.In monorepos every package lives under
packages/<name>/, sopkgRelDiris non-empty and the bug was masked.This same pattern appeared in two places:
findChangedPackagesincheck.ts— used bycheckandci checkmapFilesToPackagesingenerate.ts— used bygenerateto attribute commits to packagesSo
generatewas also failing to attribute any commit to the root package in single-package repos.Fix
Treat the root package (empty relative dir) as owning every changed file. In
findChangedPackages,changedFilePatternsis still honored:Tests
findChangedPackages: root-package detection,changedFilePatternshonoring, monorepo directory scoping (regression).mapFilesToPackages: root-package detection + monorepo scoping (exported the helper to test it).Full suite: 314 pass / 0 fail. Lint, fmt, and typecheck clean.