mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import tauriConfig from "../../src-tauri/tauri.conf.json";
|
|
|
|
export const getBuildConfig = () => {
|
|
if (typeof process === "undefined") {
|
|
throw Error(
|
|
"[Server Config] you are importing a nodejs-only module outside of nodejs",
|
|
);
|
|
}
|
|
|
|
const buildMode = process.env.BUILD_MODE ?? "standalone";
|
|
const isApp = !!process.env.BUILD_APP;
|
|
const version = "v" + tauriConfig.package.version;
|
|
|
|
const commitInfo = (() => {
|
|
return {
|
|
commitDate: "unknown",
|
|
commitHash: "unknown",
|
|
};
|
|
// try {
|
|
// const childProcess = require("child_process");
|
|
// const commitDate: string = childProcess
|
|
// .execSync('git log -1 --format="%at000" --date=unix')
|
|
// .toString()
|
|
// .trim();
|
|
// const commitHash: string = childProcess
|
|
// .execSync('git log --pretty=format:"%H" -n 1')
|
|
// .toString()
|
|
// .trim();
|
|
//
|
|
// return { commitDate, commitHash };
|
|
// } catch (e) {
|
|
// console.error("[Build Config] No git or not from git repo.");
|
|
// return {
|
|
// commitDate: "unknown",
|
|
// commitHash: "unknown",
|
|
// };
|
|
// }
|
|
})();
|
|
|
|
return {
|
|
version,
|
|
...commitInfo,
|
|
buildMode,
|
|
isApp,
|
|
};
|
|
};
|
|
|
|
export type BuildConfig = ReturnType<typeof getBuildConfig>;
|