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",
"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": {

View File

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

View File

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

View File

@@ -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": [

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)