You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
942 B

/**
* Generate health check JSON file at build time
*/
import { writeFileSync, readFileSync } from 'fs';
import { join } from 'path';
// Read version from package.json
let version = '0.1.0';
try {
const packageJsonPath = join(process.cwd(), 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
version = packageJson.version || process.env.npm_package_version || '0.1.0';
} catch (error) {
console.warn('Failed to read version from package.json, using fallback:', error);
version = process.env.npm_package_version || '0.1.0';
}
const healthz = {
status: 'ok',
service: 'aitherboard',
version: version,
buildTime: new Date().toISOString(),
gitCommit: process.env.GIT_COMMIT || 'unknown',
timestamp: Date.now()
};
const outputPath = join(process.cwd(), 'static', 'healthz.json');
writeFileSync(outputPath, JSON.stringify(healthz, null, 2));
console.log('Generated healthz.json');