diff --git a/bun.lock b/bun.lock index d26481c..1a3f44e 100644 --- a/bun.lock +++ b/bun.lock @@ -8,6 +8,7 @@ "@elron/svelte-audio-store": "1.0.0", "@fontsource/sora": "^5.2.6", "@fontsource/space-mono": "^5.2.8", + "@iarna/toml": "^2.2.5", "@number-flow/svelte": "^0.3.9", "@tailwindcss/typography": "0.5.16", "@tauri-apps/api": "2.6.0", @@ -161,6 +162,8 @@ "@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="], + "@iarna/toml": ["@iarna/toml@2.2.5", "", {}, "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg=="], + "@internationalized/date": ["@internationalized/date@3.8.2", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-/wENk7CbvLbkUvX1tu0mwq49CVkkWpkXubGel6birjRPyo6uQ4nQpnq5xZu823zRCwwn82zgHrvgF1vZyvmVgA=="], "@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="], diff --git a/package.json b/package.json index afa3c0b..674a465 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,14 @@ "type": "module", "scripts": { "debug": "bun run tauri dev", - "dev": "vite dev", - "build": "vite build", + "build": "bun ./scripts/sync-version.ts && bun run tauri:build", + "vite:dev": "vite dev", + "vite:build": "vite build", "tauri:build": "tauri build", - "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "tauri": "tauri", - "update-logo": "bun run tauri icon ./static/logo.png", + "tauri:update-logo": "bun run tauri icon ./static/logo.png", "format": "prettier --write .", "lint": "prettier --check . && eslint ." }, @@ -22,6 +22,7 @@ "@elron/svelte-audio-store": "1.0.0", "@fontsource/sora": "^5.2.6", "@fontsource/space-mono": "^5.2.8", + "@iarna/toml": "^2.2.5", "@number-flow/svelte": "^0.3.9", "@tailwindcss/typography": "0.5.16", "@tauri-apps/api": "2.6.0", diff --git a/scripts/sync-version.ts b/scripts/sync-version.ts new file mode 100644 index 0000000..362b556 --- /dev/null +++ b/scripts/sync-version.ts @@ -0,0 +1,19 @@ +import fs from 'fs'; +import path from 'path'; +import * as toml from '@iarna/toml'; +import { cwd } from 'process'; + +const cargoTomlPath = path.join(cwd(), 'src-tauri', 'Cargo.toml'); +const tauriConfPath = path.join(cwd(), 'src-tauri', 'tauri.conf.json'); + +const cargoToml = fs.readFileSync(cargoTomlPath, 'utf8'); +const cargo = toml.parse(cargoToml) as Record; + +const version = cargo.package['version']; +if (!version) throw new Error('Could not find version in Cargo.toml'); + +const tauriConf = JSON.parse(fs.readFileSync(tauriConfPath, 'utf8')); +tauriConf.version = version; + +fs.writeFileSync(tauriConfPath, JSON.stringify(tauriConf, null, 2)); +console.log(`✅ Synced tauri.conf.json version to ${version}`); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 6d33f60..c869beb 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,12 +1,12 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "ezpplauncher", - "version": "0.1.0", + "version": "3.0.0-beta.1", "identifier": "farm.ezpp.launcher", "build": { - "beforeDevCommand": "bun run dev", + "beforeDevCommand": "bun run vite:dev", "devUrl": "http://localhost:1420", - "beforeBuildCommand": "bun run build", + "beforeBuildCommand": "bun run vite:build", "frontendDist": "../build" }, "app": { @@ -50,4 +50,4 @@ "icons/icon.ico" ] } -} +} \ No newline at end of file