diff --git a/package-lock.json b/package-lock.json index cd60d828..ca42abd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "amacc1ng", - "version": "0.5.0", + "version": "0.6.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "amacc1ng", - "version": "0.5.0", + "version": "0.6.3", "hasInstallScript": true, "license": "AGPL-3.0-or-later", "devDependencies": { diff --git a/package.json b/package.json index 0fe2ff3d..5ca4d4ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amacc1ng", - "version": "0.5.0", + "version": "0.6.3", "license": "AGPL-3.0-or-later", "private": true, "repository": { @@ -24,6 +24,7 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", "minify-icons": "ts-node-esm src/tools/minify-icon-font.ts", + "version": "ts-node-esm src/tools/version.ts && git add src-tauri/Cargo.toml && git add src-tauri/tauri.conf.json", "lint": "prettier --plugin-search-dir . --check .", "format": "prettier --plugin-search-dir . --write .", "typesafe-i18n": "typesafe-i18n" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 884c8834..8cb68903 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "0.5.0" +version = "0.6.3" description = "A Tauri App" authors = ["Thea Schöbl "] license = "AGPL-3" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 94ebcecb..3cd55cc3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -6,21 +6,14 @@ "devPath": "http://localhost:5173", "distDir": "../build" }, - "package": { - "productName": "amacc1ng", - "version": "0.5.0" - }, + "package": { "productName": "amacc1ng", "version": "0.6.3" }, "tauri": { - "allowlist": { - "all": false - }, + "allowlist": { "all": false }, "bundle": { "active": true, "category": "DeveloperTool", "copyright": "AGPL-3.0-or-later", - "deb": { - "depends": [] - }, + "deb": { "depends": [] }, "externalBin": [], "icon": [ "icons/32x32.png", @@ -47,9 +40,7 @@ "timestampUrl": "" } }, - "security": { - "csp": null - }, + "security": { "csp": null }, "updater": { "active": true, "endpoints": [ diff --git a/src/tools/version.ts b/src/tools/version.ts new file mode 100644 index 00000000..238f81d7 --- /dev/null +++ b/src/tools/version.ts @@ -0,0 +1,20 @@ +import {readFile, writeFile} from "fs/promises" +import {fileURLToPath} from "url" +import * as path from "path" +import {format} from "prettier" + +const projectDir = path.resolve(fileURLToPath(import.meta.url), "..", "..", "..") + +const {version} = JSON.parse(await readFile(path.join(projectDir, "package.json"), "utf8")) + +const tauriConfigPath = path.join(projectDir, "src-tauri", "tauri.conf.json") + +const tauriConfig = JSON.parse(await readFile(tauriConfigPath, "utf8")) +tauriConfig.package.version = version +await writeFile(tauriConfigPath, await format(JSON.stringify(tauriConfig), {parser: "json"})) + +const cargoTomlPath = path.join(projectDir, "src-tauri", "Cargo.toml") + +const cargoToml = await readFile(cargoTomlPath, "utf8") +const modified = cargoToml.replace(/^\s*version\s*=\s*"\d\.\d.\d"\s*$/m, `version = "${version}"`) +await writeFile(cargoTomlPath, modified)