add build number (for page footer)

This commit is contained in:
2025-07-19 22:57:35 -04:00
parent a10cf5ccbe
commit 1c07198fa4
3 changed files with 16 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
--- ---
import { metaData, API_URL } from "../config"; import { metaData, API_URL } from "../config";
import RandomMsg from "../components/RandomMsg"; import RandomMsg from "../components/RandomMsg";
import { buildTime } from '../utils/buildTime.js'; import { buildTime, buildNumber } from '../utils/buildTime.js';
const YEAR = new Date().getFullYear(); const YEAR = new Date().getFullYear();
var ENVIRONMENT = (Astro.url.hostname === "localhost") ? "Dev": "Prod"; var ENVIRONMENT = (Astro.url.hostname === "localhost") ? "Dev": "Prod";
@@ -16,7 +16,9 @@ var ENVIRONMENT = (Astro.url.hostname === "localhost") ? "Dev": "Prod";
</small> </small>
<RandomMsg client:only="react" /> <RandomMsg client:only="react" />
<div style="margin-top: 15px; bottom: 0%"> <div style="margin-top: 15px; bottom: 0%">
<small>Built: {buildTime} UTC</small> <small>Build# {buildNumber}
<br>
Built: {buildTime} UTC</small>
</div> </div>
<span style="font-size: 0.75rem; font-style: italic; margin-left: 100%">{ENVIRONMENT}</span> <span style="font-size: 0.75rem; font-style: italic; margin-left: 100%">{ENVIRONMENT}</span>
</div> </div>

View File

@@ -12,3 +12,7 @@ export const api = "https://api.codey.lol";
export const API_URL = api; export const API_URL = api;
export const socialLinks = { export const socialLinks = {
}; };
export const MAJOR_VERSION = "0.0"
export const RELEASE_FLAG = "Alpha";
let l = "21f";

View File

@@ -1,3 +1,10 @@
import { generate, validate, parse, format } from "build-number-generator";
import { MAJOR_VERSION, RELEASE_FLAG } from "../config";
export const buildTime = new Date().toLocaleString(undefined, { export const buildTime = new Date().toLocaleString(undefined, {
timeZone: "UTC", timeZone: "UTC",
}); });
export var buildNumber = generate(MAJOR_VERSION);
if (RELEASE_FLAG.length) {
buildNumber = `${buildNumber} (${RELEASE_FLAG})`;
}