benduran / lets-version

A package that reads your conventional commits and git history and recommends (or applies) a SemVer version bump for you
MIT License
1 stars 3 forks source link

Bug in updating package dependencies for complicated monorepo #28

Closed artemdanylenko closed 1 month ago

artemdanylenko commented 2 months ago

Setup a Monorepo with 4 packages: c depends on a and b, both a and b depend on d c / \ a b \ / d

When d is changed - we expect all packages to get versioned and the package.json dependencies for all packages to be updated. Actual: the package.json for c only has an update for one of the 2 dependencies (a or b)

Example commit https://github.com/artemdanylenko/lets-bug/commit/3aa2a8bc47a32effaf987fa7f09c9e2387ba588b

packages/c/package.json should have "dependencies": { "a": "^1.0.6" "b": "^1.0.6" },

but instead has "dependencies": { "a": "^1.0.5", "b": "^1.0.6" },

The issue is not present in 0.8.4 but is present in 1.1.3

artemdanylenko commented 2 months ago

I think the problem is with synchronizeBumps constructing a fresh buildLocalDependencyGraph on each run so later dep graphs override previous ones.

benduran commented 1 month ago

Hi @artemdanylenko thanks for the report. To your point, there is likely a bug with the latest changes that swapped to iterating through the new dependency graph data structure (vs the older, more convoluted bug "correctish" logic). I'm in the process of moving, so I may not be able to get to this until later in the week or next week (relocating and flying to the UK for work). Happy to review any PRs you may have, though.

Thanks for your patience!

artemdanylenko commented 1 month ago

Hey! This is not urgent for us, as I rolled back to the previously used version, but I am also happy to contribute.

I did try moving the depGraph one level up to the getRecommendedBumpsByPackage, but that didn't seem to fix the issue and also started to trigger some other asserts in synchronizeBumps. I'll continue digging if I have time.

benduran commented 1 month ago

@better-builds/lets-version@1.1.4 has been published!