chore: track semver in package.json

This commit is contained in:
Aarnav Tale 2025-03-11 22:44:23 -04:00
parent 251c16ca48
commit 79d83537d5
No known key found for this signature in database
2 changed files with 8 additions and 6 deletions

View File

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

View File

@ -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({