aboutsummaryrefslogtreecommitdiff
path: root/build.mjs
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-08-30 01:42:47 +0200
committerVendicated <vendicated@riseup.net>2022-08-30 01:42:47 +0200
commitcb288e204dd531b31f957f82150398d22930fdeb (patch)
treeb8bb039982c3fee10e62e4767ce0f88748f50d25 /build.mjs
parent80b279d3c311e60787aa46a150b2d87e8ebaf69a (diff)
downloadVencord-cb288e204dd531b31f957f82150398d22930fdeb.tar.gz
Vencord-cb288e204dd531b31f957f82150398d22930fdeb.tar.bz2
Vencord-cb288e204dd531b31f957f82150398d22930fdeb.zip
Add Settings 'page', gitHash, electron version in settings
Diffstat (limited to 'build.mjs')
-rwxr-xr-xbuild.mjs23
1 files changed, 21 insertions, 2 deletions
diff --git a/build.mjs b/build.mjs
index 2b1550a..f2a4447 100755
--- a/build.mjs
+++ b/build.mjs
@@ -1,4 +1,5 @@
#!/usr/bin/node
+import { execSync } from "child_process";
import esbuild from "esbuild";
import { readdirSync } from "fs";
import { performance } from "perf_hooks";
@@ -59,6 +60,23 @@ const globPlugins = {
}
};
+const gitHash = execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim();
+/**
+ * @type {esbuild.Plugin}
+ */
+const gitHashPlugin = {
+ name: "git-hash-plugin",
+ setup: build => {
+ const filter = /^git-hash$/;
+ build.onResolve({ filter }, args => ({
+ namespace: "git-hash", path: args.path
+ }));
+ build.onLoad({ filter, namespace: "git-hash" }, () => ({
+ contents: `export default "${gitHash}"`
+ }));
+ }
+};
+
const begin = performance.now();
await Promise.all([
esbuild.build({
@@ -92,9 +110,10 @@ await Promise.all([
target: ["esnext"],
footer: { js: "//# sourceURL=VencordRenderer" },
globalName: "Vencord",
- external: ["plugins"],
+ external: ["plugins", "git-hash"],
plugins: [
- globPlugins
+ globPlugins,
+ gitHashPlugin
],
sourcemap: "inline",
watch,