2024-07-21 11:45:31 +03:00
|
|
|
import child_process from "child_process";
|
|
|
|
import fs from "fs";
|
|
|
|
|
|
|
|
function getBuildDate() {
|
|
|
|
const now = new Date();
|
|
|
|
now.setMilliseconds(0);
|
2025-01-09 18:07:02 +02:00
|
|
|
return now.toISOString().replace(".000", "");
|
2024-07-21 11:45:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getGitRevision() {
|
2025-01-09 18:07:02 +02:00
|
|
|
return child_process.execSync('git log -1 --format="%H"').toString("utf-8").trimEnd();
|
2024-07-21 11:45:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const output = `\
|
2024-07-23 00:17:20 +03:00
|
|
|
export default {
|
2024-07-21 11:45:31 +03:00
|
|
|
buildDate: "${getBuildDate()}",
|
|
|
|
buildRevision: "${getGitRevision()}"
|
|
|
|
};
|
|
|
|
`;
|
|
|
|
|
2025-04-18 16:46:34 +03:00
|
|
|
fs.writeFileSync("apps/server/src/services/build.ts", output);
|