chore: track semver in package.json
This commit is contained in:
parent
251c16ca48
commit
79d83537d5
@ -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",
|
||||
|
||||
@ -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({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user