mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-23 21:22:16 +00:00
build: include version.txt in dist
This commit is contained in:
parent
80fc595833
commit
1ef1db30ab
@ -5,7 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
"build": "tsc -p tsconfig.prod.json && vite build",
|
"build": "tsc -p tsconfig.prod.json && vite build && node scripts/write-version.mjs",
|
||||||
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||||
"format": "prettier -w .",
|
"format": "prettier -w .",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
|
11
scripts/write-version.mjs
Normal file
11
scripts/write-version.mjs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* eslint-env node */
|
||||||
|
import { readFileSync, writeFileSync } from 'node:fs';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { dirname } from 'node:path';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
|
const pkgJson = JSON.parse(readFileSync(__dirname + '/../package.json', 'utf-8'));
|
||||||
|
const pkgVer = (pkgJson.version ?? 'unknown') + '\n';
|
||||||
|
writeFileSync(__dirname + '/../dist/version.txt', pkgVer, 'utf-8');
|
Loading…
Reference in New Issue
Block a user