diff --git a/bump.config.ts b/bump.config.ts new file mode 100644 index 0000000..0d3cb77 --- /dev/null +++ b/bump.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "bumpp"; + +export default defineConfig({ + release: "patch", + commit: false, + tag: false, + push: false, + files: [ + "package.json", + "src-tauri/tauri.conf.json", + "src-tauri/Cargo.toml" + ] +}); diff --git a/package.json b/package.json index 78752d2..d591305 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,7 @@ "preinstall": "npx only-allow pnpm", "postinstall": "nuxt prepare", "lint": "eslint . --fix", - "bump:patch": "tsx scripts/bump.ts patch && eslint package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml --fix", - "bump:minor": "tsx scripts/bump.ts minor && eslint package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml --fix", - "bump:major": "tsx scripts/bump.ts major && eslint package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml --fix", + "bump": "bumpp", "tauri": "tauri", "tauri:dev": "tauri dev", "tauri:build": "tauri build", @@ -40,6 +38,7 @@ "@unocss/nuxt": "^0.61.0", "@vueuse/core": "^10.11.0", "@vueuse/nuxt": "^10.11.0", + "bumpp": "^9.4.1", "eslint": "8.57.0", "internal-ip": "^8.0.0", "nuxt": "^3.12.2", diff --git a/scripts/bump.ts b/scripts/bump.ts deleted file mode 100644 index fa883e3..0000000 --- a/scripts/bump.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { readFileSync, writeFileSync } from "node:fs"; -import { parse, stringify } from "@iarna/toml"; - -type BumpMethod = "patch" | "minor" | "major"; - -const bumpVersion = (currentVersion: string) => { - const method = process.argv[2] || "patch"; - - const parts = currentVersion.split("."); - let major = Number.parseInt(parts[0], 10); - let minor = Number.parseInt(parts[1], 10); - let patch = Number.parseInt(parts[2], 10); - - if (method === "patch") { - patch += 1; - } else if (method === "minor") { - minor += 1; - patch = 0; - } else if (method === "major") { - major += 1; - minor = 0; - patch = 0; - } - - const newVersion = `${major}.${minor}.${patch}`; - - console.log(`Version bumped to ${newVersion}`); - - return newVersion; -}; - -const packageJson = JSON.parse(readFileSync("./package.json", "utf-8")); -const tauriConfig = JSON.parse(readFileSync("./src-tauri/tauri.conf.json", "utf-8")); -const tauriToml = parse(readFileSync("./src-tauri/Cargo.toml", "utf-8")); - -packageJson.version = bumpVersion(packageJson.version); -tauriConfig.version = bumpVersion(tauriConfig.version); - -// @ts-expect-error No interface for parsed TOML -tauriToml.package.version = bumpVersion(tauriToml.package.version); - -writeFileSync("./package.json", JSON.stringify(packageJson, null, "\t")); -writeFileSync("./src-tauri/tauri.conf.json", JSON.stringify(tauriConfig, null, "\t")); -writeFileSync("./src-tauri/Cargo.toml", stringify(tauriToml));