2022-12-03 04:23:18 +00:00
|
|
|
import { execSync } from "child_process";
|
|
|
|
|
import fs from "fs";
|
2020-05-09 14:45:23 +00:00
|
|
|
|
2022-12-03 04:23:18 +00:00
|
|
|
export function getRevision(useLast = false) {
|
|
|
|
|
const commitHash = execSync("git rev-parse --short " + (useLast ? "HEAD^1" : "HEAD")).toString("ascii");
|
2025-06-19 01:51:34 +00:00
|
|
|
return commitHash.trim();
|
2022-12-03 04:23:18 +00:00
|
|
|
}
|
2020-08-07 07:16:23 +00:00
|
|
|
|
2022-12-03 04:23:18 +00:00
|
|
|
export function getAllResourceImages() {
|
2025-06-19 01:51:34 +00:00
|
|
|
return fs.globSync("./**/*.@(png|svg|jpg)", { cwd: "../res" }).filter(f => {
|
|
|
|
|
if (f.indexOf("ui") >= 0) {
|
|
|
|
|
// We drop all ui images except for the noinline ones
|
|
|
|
|
return f.indexOf("noinline") >= 0;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
});
|
2022-12-03 04:23:18 +00:00
|
|
|
}
|
2020-05-09 14:45:23 +00:00
|
|
|
|
2022-12-03 04:23:18 +00:00
|
|
|
export function getVersion() {
|
2024-04-14 16:03:27 +00:00
|
|
|
// Use the version number specified in package.json
|
|
|
|
|
return JSON.parse(fs.readFileSync("../package.json", "utf-8")).version;
|
2024-06-20 10:00:58 +00:00
|
|
|
}
|