update version hook

This commit is contained in:
2023-09-22 20:27:59 +02:00
parent e7a52221d2
commit 074f1da48d
5 changed files with 29 additions and 17 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "amacc1ng", "name": "amacc1ng",
"version": "0.5.0", "version": "0.6.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "amacc1ng", "name": "amacc1ng",
"version": "0.5.0", "version": "0.6.3",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"devDependencies": { "devDependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "amacc1ng", "name": "amacc1ng",
"version": "0.5.0", "version": "0.6.3",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"private": true, "private": true,
"repository": { "repository": {
@@ -24,6 +24,7 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"minify-icons": "ts-node-esm src/tools/minify-icon-font.ts", "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 .", "lint": "prettier --plugin-search-dir . --check .",
"format": "prettier --plugin-search-dir . --write .", "format": "prettier --plugin-search-dir . --write .",
"typesafe-i18n": "typesafe-i18n" "typesafe-i18n": "typesafe-i18n"

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "app" name = "app"
version = "0.5.0" version = "0.6.3"
description = "A Tauri App" description = "A Tauri App"
authors = ["Thea Schöbl <dev@theaninova.de>"] authors = ["Thea Schöbl <dev@theaninova.de>"]
license = "AGPL-3" license = "AGPL-3"

View File

@@ -6,21 +6,14 @@
"devPath": "http://localhost:5173", "devPath": "http://localhost:5173",
"distDir": "../build" "distDir": "../build"
}, },
"package": { "package": { "productName": "amacc1ng", "version": "0.6.3" },
"productName": "amacc1ng",
"version": "0.5.0"
},
"tauri": { "tauri": {
"allowlist": { "allowlist": { "all": false },
"all": false
},
"bundle": { "bundle": {
"active": true, "active": true,
"category": "DeveloperTool", "category": "DeveloperTool",
"copyright": "AGPL-3.0-or-later", "copyright": "AGPL-3.0-or-later",
"deb": { "deb": { "depends": [] },
"depends": []
},
"externalBin": [], "externalBin": [],
"icon": [ "icon": [
"icons/32x32.png", "icons/32x32.png",
@@ -47,9 +40,7 @@
"timestampUrl": "" "timestampUrl": ""
} }
}, },
"security": { "security": { "csp": null },
"csp": null
},
"updater": { "updater": {
"active": true, "active": true,
"endpoints": [ "endpoints": [

20
src/tools/version.ts Normal file
View File

@@ -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)