mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 21:17:24 +08:00
refactor: build/runtime/client configs
This commit is contained in:
27
app/config/build.ts
Normal file
27
app/config/build.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
const COMMIT_ID: string = (() => {
|
||||
try {
|
||||
const childProcess = require("child_process");
|
||||
return (
|
||||
childProcess
|
||||
// .execSync("git describe --tags --abbrev=0")
|
||||
.execSync("git rev-parse --short HEAD")
|
||||
.toString()
|
||||
.trim()
|
||||
);
|
||||
} catch (e) {
|
||||
console.error("[Build Config] No git or not from git repo.");
|
||||
return "unknown";
|
||||
}
|
||||
})();
|
||||
|
||||
export const getBuildConfig = () => {
|
||||
if (typeof process === "undefined") {
|
||||
throw Error(
|
||||
"[Server Config] you are importing a nodejs-only module outside of nodejs",
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
commitId: COMMIT_ID,
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user