Skip to content
Open
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
4 changes: 2 additions & 2 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bugscope",
"private": true,
"version": "0.15.1",
"version": "0.18.1",
"type": "module",
"scripts": {
"setup": "bash scripts/setup.sh",
Expand All @@ -12,7 +12,8 @@
"dev:no-analytics": "cargo tauri dev",
"build": "cargo tauri build",
"lint": "eslint .",
"preview": "vite preview"
"preview": "vite preview",
"version:bump": "node scripts/bump-version.js"
},
"dependencies": {
"@tauri-apps/api": "^2",
Expand Down
61 changes: 61 additions & 0 deletions scripts/bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env node
// Usage: node scripts/bump-version.js <new-version>
// Updates version in package.json and src-tauri/Cargo.toml

import { readFileSync, writeFileSync } from "fs";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
import { execSync } from "child_process";

const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, "..");

const newVersion = process.argv[2];
if (!newVersion) {
console.error("Usage: node scripts/bump-version.js <new-version>");
process.exit(1);
}

if (!/^\d+\.\d+\.\d+/.test(newVersion)) {
console.error(`Invalid version format: "${newVersion}". Expected semver (e.g. 1.2.3)`);
process.exit(1);
}

// Update package.json
const pkgPath = resolve(root, "package.json");
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
const oldVersion = pkg.version;
pkg.version = newVersion;
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
console.log(`package.json: ${oldVersion} → ${newVersion}`);

// Update src-tauri/Cargo.toml
const cargoPath = resolve(root, "src-tauri", "Cargo.toml");
let cargo = readFileSync(cargoPath, "utf8");
cargo = cargo.replace(
/^(version\s*=\s*)"[\d.]+"(\s*$)/m,
`$1"${newVersion}"$2`
);
writeFileSync(cargoPath, cargo);
console.log(`src-tauri/Cargo.toml: ${oldVersion} → ${newVersion}`);

// Update package-lock.json
try {
execSync("npm install --package-lock-only --ignore-scripts", { cwd: root, stdio: "inherit" });
console.log(`package-lock.json: updated`);
} catch {
console.warn("Warning: failed to update package-lock.json — run `npm install` manually");
}

// Update Cargo.lock
try {
execSync(`cargo update --precise ${newVersion} --manifest-path src-tauri/Cargo.toml bugscope`, {
cwd: root,
stdio: "inherit",
});
console.log(`src-tauri/Cargo.lock: updated`);
} catch {
console.warn("Warning: failed to update Cargo.lock — run `cargo update` in src-tauri/ manually");
}

console.log(`\nVersion bumped to ${newVersion}`);
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bugscope"
version = "0.15.1"
version = "0.18.1"
edition = "2021"

[lib]
Expand Down
1 change: 0 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/nicegui/tauri-v2-schema/main/tauri.conf.json.schema",
"productName": "Bugscope",
"version": "0.15.1",
"identifier": "com.bugscope.desktop",
"build": {
"frontendDist": "../dist",
Expand Down
Loading