feat(monorepo): rewrite dependent version constraints on release - #783
Conversation
07afcf9 to
3d8cb06
Compare
3d8cb06 to
71b7214
Compare
|
Both fixed, and you were right to push back on that manual test — the Blocking finding. Dry-run nit. Taken. with both manifests byte-identical afterwards. Two tests in Re-verified end-to-end against a bare remote: dry run previews and touches nothing, the real run rewrites |
There was a problem hiding this comment.
Follow-up review. Both findings from the last pass are fixed in 71b7214: the propagate: "none" dependent is now correctly skipped before rewriting, and --dry-run now previews the rewrite via a plan/apply split instead of skipping the whole rewrite. No new issues in the diff since. Approving.
Part 2 of #493. Stacked on #782 (the propagation policy) — merge that first, this PR's diff is only the manifest rewrite.
When a package is bumped, every dependent that declares it via
dependsOnstill pins the old range. This addsworkspace.updateDependents(defaultfalse): after the cascade settles, each dependent's manifest has its constraint for the bumped package rewritten to the new version, and the file is staged in the same release commit.{ "workspace": { "updateDependents": true }, "package": [ { "name": "core", "path": "core", "versionedFiles": [{ "path": "core/package.json", "format": "json" }] }, { "name": "cli", "path": "cli", "dependsOn": ["core"], "versionedFiles": [{ "path": "cli/package.json", "format": "json" }] } ] }cli/package.jsongoes from"core": "^1.0.0"to"core": "^1.1.0"in the release commit.What gets rewritten
json(dependencies,devDependencies,peerDependencies,optionalDependencies) andtoml(dependencies,dev-dependencies,build-dependencies, including the{ version = "…", path = "…" }inline form). Every other format is skipped.Only a plain operator + version is touched, and the operator is preserved —
^1.2.3→^2.0.0, not a bare pin. Anything carrying intent a pin would destroy is left for a human:workspace:*,file:/git:/npm:specs,1.x,*,latest,>=1.0.0 <2.0.0,^1.0.0 || ^2.0.0. A missing manifest, an unparseable one, or an absent dependency is a no-op, never a failed release.The rewrite runs after the cascade so a constraint always lands on the version its upstream actually ended up at. It writes only when the bytes change, so a re-run adds nothing to the commit.
Notes
find_nested_string_value_spaninformats/json.rsis new — the existing walker only found top-level keys, and dependency tables are nested.workspace:*untouched, and apropagate: "none"dependent neither bumped nor rewritten.Part of #493