feat: Show the build date on the loading banner of unreleased builds (#2659)

This commit is contained in:
Dermot Duffy
2026-08-05 22:15:00 -07:00
committed by GitHub
parent c137f4c00c
commit 567690831c
7 changed files with 85 additions and 5 deletions
+9 -2
View File
@@ -1,6 +1,8 @@
import { execFileSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { BUILD_DATE_PLACEHOLDER } from './build-date-plugin.js';
/**
* Asks git something or gives back nothing when it cannot be asked.
*/
@@ -23,7 +25,11 @@ const getPackageVersion = () =>
*
* `releaseVersion` is the version being released, which only the release
* workflow knows; a build without one reports the version in `package.json`, or
* a development build the commit it was made from.
* a development build the commit it was made from. Its presence is what makes a
* build a released one.
*
* The build date is a placeholder here, written in for by the `buildDate`
* plugin as each build's output is generated.
*
* The values are JSON so that a bundler can drop them in as written.
*/
@@ -35,10 +41,11 @@ export const getBuildDefines = ({ dev, releaseVersion }) => {
__ADVANCED_CAMERA_CARD_RELEASE_VERSION__: JSON.stringify(
releaseVersion ?? (dev ? developmentVersion : getPackageVersion()),
),
__ADVANCED_CAMERA_CARD_IS_RELEASE_BUILD__: JSON.stringify(!!releaseVersion),
__ADVANCED_CAMERA_CARD_GIT_HASH__: JSON.stringify(gitHash),
__ADVANCED_CAMERA_CARD_GIT_DATE__: JSON.stringify(
askGit('log', '-1', '--format=%cI'),
),
__ADVANCED_CAMERA_CARD_BUILD_DATE__: JSON.stringify(new Date().toISOString()),
__ADVANCED_CAMERA_CARD_BUILD_DATE__: JSON.stringify(BUILD_DATE_PLACEHOLDER),
};
};