Simplify package.json build and start scripts

Move reading readme and versions out of package.json
This commit is contained in:
Przemek Więch
2026-04-29 00:11:06 +02:00
parent 70982305ce
commit d39143e21d
4 changed files with 22 additions and 7 deletions

View File

@@ -2,10 +2,24 @@ import {defineConfig} from 'vite';
import {resolve} from 'path';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import {execSync} from 'child_process';
let gitSha = '';
let gitTime = '';
try {
gitSha = execSync('git rev-parse --short HEAD').toString().trim();
gitTime = execSync('git log -1 --format=%ci').toString().trim();
} catch (e) {
console.error('Failed to get git info', e);
}
export default defineConfig({
// depending on your application, base can also be "/"
base: '',
define: {
'import.meta.env.VITE_GIT_SHA': JSON.stringify(gitSha),
'import.meta.env.VITE_GIT_TIME': JSON.stringify(gitTime),
},
plugins: [
react(),
viteTsconfigPaths(),