mirror of
https://github.com/titaniumnetwork-dev/Ultraviolet.git
synced 2025-05-13 12:00:01 -04:00
include build number in error screen
This commit is contained in:
parent
b78de17402
commit
aa3a176afb
2 changed files with 18 additions and 1 deletions
14
build.js
14
build.js
|
@ -1,6 +1,7 @@
|
||||||
import { rimraf } from 'rimraf';
|
import { rimraf } from 'rimraf';
|
||||||
import { copyFile, mkdir, readFile, writeFile } from 'node:fs/promises';
|
import { copyFile, mkdir, readFile, writeFile } from 'node:fs/promises';
|
||||||
import { build } from 'esbuild';
|
import { build } from 'esbuild';
|
||||||
|
import { execSync } from "node:child_process";
|
||||||
|
|
||||||
// read version from package.json
|
// read version from package.json
|
||||||
const pkg = JSON.parse(await readFile('package.json'));
|
const pkg = JSON.parse(await readFile('package.json'));
|
||||||
|
@ -29,6 +30,19 @@ let builder = await build({
|
||||||
'process.env.ULTRAVIOLET_VERSION': JSON.stringify(
|
'process.env.ULTRAVIOLET_VERSION': JSON.stringify(
|
||||||
process.env.ULTRAVIOLET_VERSION
|
process.env.ULTRAVIOLET_VERSION
|
||||||
),
|
),
|
||||||
|
'process.env.ULTRAVIOLET_COMMIT_HASH': (() => {
|
||||||
|
try {
|
||||||
|
let hash = JSON.stringify(
|
||||||
|
execSync("git rev-parse --short HEAD", {
|
||||||
|
encoding: "utf-8",
|
||||||
|
}).replace(/\r?\n|\r/g, "")
|
||||||
|
);
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
} catch (e) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
})(),
|
||||||
},
|
},
|
||||||
bundle: true,
|
bundle: true,
|
||||||
treeShaking: true,
|
treeShaking: true,
|
||||||
|
|
|
@ -442,6 +442,9 @@ function errorTemplate(
|
||||||
uvVersion.textContent = ${JSON.stringify(
|
uvVersion.textContent = ${JSON.stringify(
|
||||||
process.env.ULTRAVIOLET_VERSION
|
process.env.ULTRAVIOLET_VERSION
|
||||||
)};
|
)};
|
||||||
|
uvBuild.textContent = ${JSON.stringify(
|
||||||
|
process.env.ULTRAVIOLET_COMMIT_HASH
|
||||||
|
)};
|
||||||
`
|
`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -476,7 +479,7 @@ function errorTemplate(
|
||||||
</ul>
|
</ul>
|
||||||
<button id="reload">Reload</button>
|
<button id="reload">Reload</button>
|
||||||
<hr />
|
<hr />
|
||||||
<p><i>Ultraviolet v<span id="uvVersion"></span></i></p>
|
<p><i>Ultraviolet v<span id="uvVersion"></span> (build <span id="uvBuild"></span>)</i></p>
|
||||||
<script src="${
|
<script src="${
|
||||||
'data:application/javascript,' + encodeURIComponent(script)
|
'data:application/javascript,' + encodeURIComponent(script)
|
||||||
}"></script>
|
}"></script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue