Skip to content

Commit 0705ea4

Browse files
authored
chore: include crate version bump in x version command (#10994)
1 parent 5bf97de commit 0705ea4

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

crates/rspack_macros/Cargo.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,13 @@ proc-macro = true
1111

1212
[dependencies]
1313
proc-macro2 = { workspace = true }
14-
quote = { workspace = true }
15-
syn = { workspace = true, features = ["full", "visit-mut"] }
14+
quote = { workspace = true }
15+
syn = { workspace = true, features = [
16+
"full",
17+
"visit-mut",
18+
"derive",
19+
"parsing",
20+
"printing",
21+
"clone-impls",
22+
"proc-macro",
23+
] }

scripts/release/version.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ export async function version_handler(version, options) {
9393
}
9494
}
9595

96+
// Rust crate version is major version of `@rspack/core` - 1
97+
const nextCrateVersion = nextVersion.replace(
98+
/^(\d+)/,
99+
(match, major) => Number.parseInt(major) - 1
100+
);
101+
await $`${path.resolve(path.dirname(new URL(import.meta.url).pathname), "../../x")} crate-version custom ${nextCrateVersion}`;
102+
96103
const packageFiles = await glob("{packages,npm,crates}/*/package.json", {
97104
cwd: root,
98105
ignore: ["**/node_modules/**", "**/dist/**"],

x.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ program
259259
.argument("[custom]", "custom version when bump is 'custom'")
260260
.description("update crate version with cargo-workspaces")
261261
.action(async (bump, custom) => {
262-
await $`which cargo-workspaces || echo "cargo-workspaces is not installed, please install it first with \`cargo install cargo-workspaces\`"`;
263-
264-
// Validate bump type
262+
await $`which cargo-workspaces || echo "cargo-workspaces is not installed, please install it first with \`cargo install cargo-workspaces\`"`; // Validate bump type
265263
const validBumps = [
266264
"major",
267265
"minor",
@@ -289,7 +287,7 @@ program
289287
"version",
290288
"--exact", // Use exact version `=`
291289
"--allow-branch",
292-
"release-crates/*", // Specify which branches to allow from
290+
"release*", // Specify which branches to allow from
293291
"--no-git-push", // Do not push generated commit and tags to git remote
294292
"--no-git-tag", // Do not tag versions in git, we will tag them in `crate-publish`
295293
"--force",
@@ -364,7 +362,7 @@ program
364362
.command("version")
365363
.argument("<bump_version>", "bump version to (major|minor|patch|snapshot)")
366364
.option("--pre <string>", "pre-release tag")
367-
.description("bump version")
365+
.description("bump version for npm and rust crates")
368366
.action(version_handler);
369367

370368
program

0 commit comments

Comments
 (0)