Display repository commit count as the Synapsis version

Hop-State: A_06FP98T1AFPC938R80XJ3J0
Hop-Proposal: R_06FP98S721MFZV1BVBVDTK8
Hop-Task: T_06FP98D0VF530A9XJ2HHHWR
Hop-Attempt: AT_06FP98D0VFKNWCN4EJD46YR
This commit is contained in:
2026-07-15 00:17:28 -07:00
committed by Hop
parent 67bd0d0bbb
commit c17b27b240
6 changed files with 48 additions and 5 deletions
+14
View File
@@ -14,9 +14,23 @@ function getBuildCommit(): string {
}
}
function getBuildCommitCount(): string {
if (process.env.APP_COMMIT_COUNT) return process.env.APP_COMMIT_COUNT;
try {
return execFileSync('git', ['rev-list', '--count', 'HEAD'], {
cwd: process.cwd(),
encoding: 'utf8',
}).trim();
} catch {
return 'unknown';
}
}
const nextConfig: NextConfig = {
env: {
APP_COMMIT: getBuildCommit(),
APP_COMMIT_COUNT: getBuildCommitCount(),
APP_BUILD_DATE: process.env.APP_BUILD_DATE || new Date().toISOString(),
},