Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/js-pnpm-catalogs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@covector/apply": minor
---

`catalog:` references in package.json are left untouched during dependency bumps: pnpm rewrites them at publish time from the catalog tables in pnpm-workspace.yaml, and previously they were corrupted to a bare major version.
5 changes: 5 additions & 0 deletions .changes/range-requirement-guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@covector/apply": patch
---

Leave a dependency requirement that spans a range or floats alone instead of collapsing it onto the bumped version. A comparator range (`>=1.0 <2`), a wildcard (`1.x`), and `*` already cover the bumped version, and were previously narrowed to a single pin — `">=1.0 <2"` became `"=1.1"`. This covers requirements written behind the pnpm workspace protocol prefix (`workspace:1.x`) as well as plain ones.
5 changes: 5 additions & 0 deletions .changes/rust-target-workspace-dep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@covector/apply": patch
---

Skip dependencies declared without a version of their own in a cargo `[target]` table, such as `{ workspace = true }` or a path-only entry. Bumping a package that another crate depends on through a target table previously threw.
5 changes: 5 additions & 0 deletions .changes/rust-workspace-inherited-version-read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@covector/files": patch
---

Read the version off `[workspace.package]` when a Cargo manifest inherits it, matching the existing write support. Applying a bump to a crate whose version is declared at the workspace root previously left the manifest unchanged.
6 changes: 6 additions & 0 deletions .changes/rust-workspace-root-deps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@covector/apply": minor
"@covector/files": minor
---

Bump version requirements for member crates declared in a cargo workspace root manifest's `[workspace.dependencies]` table. Requirements keep their form (partial pins stay partial, range prefixes are preserved), while path-only entries, `*` requirements, and comparator or wildcard ranges (`>=1.2, <2`, `1.*`) are left untouched.
6 changes: 6 additions & 0 deletions __fixtures__/pkg.js-pnpm-catalog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"private": true,
"name": "js-pnpm-catalog",
"description": "workspace with pnpm catalogs",
"version": "1.0.0"
}
11 changes: 11 additions & 0 deletions __fixtures__/pkg.js-pnpm-catalog/packages/pkg-a/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "js-catalog-pkg-a",
"version": "1.0.0",
"dependencies": {
"react": "catalog:",
"js-catalog-pkg-b": "catalog:"
},
"devDependencies": {
"js-catalog-pkg-c": "catalog:tools"
}
}
4 changes: 4 additions & 0 deletions __fixtures__/pkg.js-pnpm-catalog/packages/pkg-b/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "js-catalog-pkg-b",
"version": "1.0.0"
}
4 changes: 4 additions & 0 deletions __fixtures__/pkg.js-pnpm-catalog/packages/pkg-c/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "js-catalog-pkg-c",
"version": "1.0.0"
}
11 changes: 11 additions & 0 deletions __fixtures__/pkg.js-pnpm-catalog/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
packages:
- "packages/*"

# internal packages pinned here
catalog:
react: ^18.2.0
js-catalog-pkg-b: ^1.0.0

catalogs:
tools:
js-catalog-pkg-c: "1.0"
10 changes: 10 additions & 0 deletions __fixtures__/pkg.js-pnpm-workspace/packages/pkg-d/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "pnpm-workspace-pkg-d",
"version": "1.0.0",
"dependencies": {
"pnpm-workspace-pkg-b": "workspace:1.x"
},
"devDependencies": {
"pnpm-workspace-pkg-c": "workspace:>=1.0 <2"
}
}
9 changes: 9 additions & 0 deletions __fixtures__/pkg.js-range-deps/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"private": true,
"name": "js-range-deps",
"description": "workspace",
"version": "1.0.0",
"workspaces": [
"packages/*"
]
}
11 changes: 11 additions & 0 deletions __fixtures__/pkg.js-range-deps/packages/pkg-a/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "range-deps-pkg-a",
"version": "1.0.0",
"dependencies": {
"range-deps-pkg-b": ">=1.0 <2",
"range-deps-pkg-c": "*"
},
"devDependencies": {
"range-deps-pkg-d": "1.x"
}
}
4 changes: 4 additions & 0 deletions __fixtures__/pkg.js-range-deps/packages/pkg-b/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "range-deps-pkg-b",
"version": "1.0.0"
}
4 changes: 4 additions & 0 deletions __fixtures__/pkg.js-range-deps/packages/pkg-c/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "range-deps-pkg-c",
"version": "1.0.0"
}
4 changes: 4 additions & 0 deletions __fixtures__/pkg.js-range-deps/packages/pkg-d/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "range-deps-pkg-d",
"version": "1.0.0"
}
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-single-nested/crates/pkg-a/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_single_nested_fixture"
version = "0.5.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]
members = ["pkg-a", "pkg-b"]

[workspace.package]
version = "1.2.3"

[workspace.dependencies]
rust_root_inherited_fixture = { version = "1.2", path = "pkg-a" }
rust_root_inherited_helper_fixture = { path = "pkg-b", default-features = false }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "rust_root_inherited_fixture"
version.workspace = true

[dependencies]
rust_root_inherited_helper_fixture = { workspace = true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_inherited_helper_fixture"
version.workspace = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
members = ["pkg-a", "pkg-b"]

[workspace.dependencies]
serde = "1.0"
rust_multi_root_pkg_a_fixture = { version = "0.5", path = "pkg-a" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_multi_root_pkg_a_fixture"
version = "0.5.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_multi_root_pkg_b_fixture"
version = "0.2.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
members = ["pkg-c"]

[workspace.dependencies]
rust_multi_root_pkg_a_fixture = { version = "^0.5", path = "../core/pkg-a" }
rust_multi_root_pkg_c_fixture = { version = "1.0", path = "pkg-c" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "rust_multi_root_pkg_c_fixture"
version = "1.0.0"

[dependencies]
rust_multi_root_pkg_a_fixture = { workspace = true }
12 changes: 12 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[workspace]
members = ["pkg-a", "pkg-b", "pkg-c", "pkg-d", "pkg-e", "pkg-f", "pkg-g"]

[workspace.dependencies]
serde = "1.0"
rust_root_pkg_a_fixture = { version = "0.5", path = "pkg-a", default-features = false }
rust_root_pkg_b_fixture = "^0.8.0"
rust_root_pkg_c_fixture = { path = "pkg-c", version = "*" }
rust_root_pkg_d_fixture = { path = "pkg-d" }
rust_root_pkg_e_fixture = ">=0.2, <0.4"
rust_root_pkg_f_fixture = "0.*"
rust_root_pkg_g_fixture = "=0.5"
14 changes: 14 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-a/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "rust_root_pkg_a_fixture"
version = "0.5.0"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Does this meant the situation where you set the version at the root, would this be like version.workspace = "true"? Have we tested for this versus the version specified here and just a path / features in the root? (Guess that is probably the normal case)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hadn't tested it, and writing the test caught a real bug, so good call. With version.workspace = true the covector package points at the root manifest and its version lives at [workspace.package]. The new requirement bump derived fine, but the version bump itself silently never landed: getPackageFileVersion was missing the [workspace.package] fallback that setPackageFileVersion already has, so the read came back empty and the manifest was written back with the old version while [workspace.dependencies] moved to the new requirement. Fixed the read to mirror the write, and added a fixture + apply test for the inherited arrangement: the root ends up with both the bumped [workspace.package] version and the bumped requirement, the path-and-features-only entry stays byte-identical, and the member manifests keep their checked-out bytes. (Your guess on the normal case is right: an entry with just a path and features has no version to bump and is left alone; that's pkg-d in the existing fixture and the helper entry in the new one.)


[dependencies]
serde = { workspace = true }
rust_root_pkg_b_fixture = { workspace = true }
rust_root_pkg_c_fixture = { workspace = true }

[dev-dependencies]
rust_root_pkg_d_fixture = { workspace = true }

[target."cfg(windows)".dependencies]
rust_root_pkg_g_fixture = { workspace = true }
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-b/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_pkg_b_fixture"
version = "0.8.0"
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_pkg_c_fixture"
version = "0.3.0"
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_pkg_d_fixture"
version = "0.2.0"
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-e/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_pkg_e_fixture"
version = "0.2.0"
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-f/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_pkg_f_fixture"
version = "0.1.0"
3 changes: 3 additions & 0 deletions __fixtures__/pkg.rust-workspace-root-deps/pkg-g/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "rust_root_pkg_g_fixture"
version = "0.5.0"
Loading
Loading