mirror of https://github.com/TriliumNext/Notes
build: Implement cross-platform build info script
parent
374a51b77c
commit
d09578735e
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
echo 'export = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.ts
|
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import child_process from "child_process";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
|
function getBuildDate() {
|
||||||
|
const now = new Date();
|
||||||
|
now.setMilliseconds(0);
|
||||||
|
return now
|
||||||
|
.toISOString()
|
||||||
|
.replace(".000", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGitRevision() {
|
||||||
|
return child_process.execSync('git log -1 --format="%H"')
|
||||||
|
.toString("utf-8")
|
||||||
|
.trimEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
const output = `\
|
||||||
|
export = {
|
||||||
|
buildDate: "${getBuildDate()}",
|
||||||
|
buildRevision: "${getGitRevision()}"
|
||||||
|
};
|
||||||
|
`;
|
||||||
|
|
||||||
|
fs.writeFileSync("src/services/build.ts", output);
|
||||||
@ -1 +1,4 @@
|
|||||||
export = { buildDate:"2024-07-14T22:32:45+03:00", buildRevision: "b811f3d399aed7e740bd8e92ef7edc7d15de7038" };
|
export = {
|
||||||
|
buildDate: "2024-07-21T08:44:01Z",
|
||||||
|
buildRevision: "374a51b77c35f5ff2e619b49f1e7aeda16005945"
|
||||||
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue