Skip to content

Commit

Permalink
add bump-version script
Browse files Browse the repository at this point in the history
  • Loading branch information
JLarky committed Dec 23, 2024
1 parent 52896c0 commit 253d043
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
37 changes: 37 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions scripts/bump-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env -S DENO_TRACE_PERMISSIONS=1 deno run --allow-env --allow-read --allow-run
import { Checkbox } from "jsr:@cliffy/prompt@1.0.0-rc.7";
import $ from "jsr:@david/dax";

const options = ["core", "solid", "tiny", "cli"];

try {
const selected = await Checkbox.prompt({
message: "Select packages to bump:",
options: options.map((opt) => ({ name: opt, value: opt, checked: false })),
minOptions: 0,
maxOptions: options.length,
});

const versions = new Map<string, string>();
for (const name of selected) {
const filename = `packages/${name}/deno.jsonc`;
await $`deno run -A jsr:@kellnerd/bump --file ${filename}`;
await $`git add ${filename}`;
versions.set(
name,
await $`cat ${filename}`.json().then((json) => json.version),
);
}
if (selected.length === 0) {
console.log("No packages selected");
Deno.exit(0);
}
await $`git commit -m ${`Release: ${
selected.map(
(name) => `@lift-html/${name}@${versions.get(name)}`,
).join(", ")
}`}`;
for (const name of selected) {
await $`git tag @lift-html/${name}@${versions.get(name) ?? ""}`;
}
console.log("Don't forget to push the changes and tags");
} catch (error) {
if (error instanceof Deno.errors.Interrupted) {
console.log("\nUser interrupted the process");
} else {
console.error("An error occurred:", error);
}
}

0 comments on commit 253d043

Please sign in to comment.