diff --git a/package.json b/package.json index dc56156..5fcd837 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "headplane", "private": true, "sideEffects": false, + "version": "0.5.3", "type": "module", "scripts": { "build": "react-router build && vite build -c server/vite.config.ts", diff --git a/vite.config.ts b/vite.config.ts index 1f6ca48..1ba3986 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,20 +1,21 @@ +import { readFile } from 'node:fs/promises'; import { reactRouter } from '@react-router/dev/vite'; +import autoprefixer from 'autoprefixer'; +import tailwindcss from 'tailwindcss'; import { defineConfig } from 'vite'; import babel from 'vite-plugin-babel'; import tsconfigPaths from 'vite-tsconfig-paths'; -import { execSync } from 'node:child_process'; -import tailwindcss from 'tailwindcss'; -import autoprefixer from 'autoprefixer'; const prefix = process.env.__INTERNAL_PREFIX || '/admin'; if (prefix.endsWith('/')) { throw new Error('Prefix must not end with a slash'); } -// Load the version via git tags -const version = execSync('git describe --tags --always').toString().trim(); +// Load the version via package.json +const pkg = await readFile('package.json', 'utf-8'); +const { version } = JSON.parse(pkg); if (!version) { - throw new Error('Unable to execute git describe'); + throw new Error('Unable to read version from package.json'); } export default defineConfig({