ChatGPT-Next-Web/app/config/build.ts

25 lines
559 B
TypeScript
Raw Normal View History

2023-04-10 17:21:34 +00:00
const COMMIT_ID: string = (() => {
try {
const childProcess = require("child_process");
2023-05-03 16:12:00 +00:00
return childProcess
.execSync('git log -1 --format="%at000" --date=unix')
.toString()
.trim();
2023-04-10 17:21:34 +00:00
} 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,
};
};