chore: track semver in package.json
This commit is contained in:
parent
251c16ca48
commit
79d83537d5
@ -2,6 +2,7 @@
|
|||||||
"name": "headplane",
|
"name": "headplane",
|
||||||
"private": true,
|
"private": true,
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
|
"version": "0.5.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "react-router build && vite build -c server/vite.config.ts",
|
"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 { reactRouter } from '@react-router/dev/vite';
|
||||||
|
import autoprefixer from 'autoprefixer';
|
||||||
|
import tailwindcss from 'tailwindcss';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import babel from 'vite-plugin-babel';
|
import babel from 'vite-plugin-babel';
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
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';
|
const prefix = process.env.__INTERNAL_PREFIX || '/admin';
|
||||||
if (prefix.endsWith('/')) {
|
if (prefix.endsWith('/')) {
|
||||||
throw new Error('Prefix must not end with a slash');
|
throw new Error('Prefix must not end with a slash');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the version via git tags
|
// Load the version via package.json
|
||||||
const version = execSync('git describe --tags --always').toString().trim();
|
const pkg = await readFile('package.json', 'utf-8');
|
||||||
|
const { version } = JSON.parse(pkg);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
throw new Error('Unable to execute git describe');
|
throw new Error('Unable to read version from package.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user