fix(companion): make reference-app exports reproducible by default

No diagram change needed: this change only makes generated reference-app timestamps deterministic and adds an override flag.
This commit is contained in:
William Valentin
2026-02-26 20:58:31 -08:00
parent 078c3799ce
commit 820af97859
10 changed files with 25 additions and 8 deletions
@@ -1,6 +1,8 @@
import { resolve } from 'node:path';
import { generateReferenceCompanionApps } from '../src/companion/index.js';
const DEFAULT_GENERATED_AT = '2026-02-27T00:00:00.000Z';
function getArg(name: string): string | undefined {
const idx = process.argv.indexOf(name);
if (idx < 0) {
@@ -16,10 +18,16 @@ function getArg(name: string): string | undefined {
async function main(): Promise<void> {
const outputDir = resolve(getArg('--output') ?? 'apps/companion');
const gatewayUrl = getArg('--url') ?? 'ws://127.0.0.1:18800';
const generatedAtArg = getArg('--generated-at');
const generatedAt = new Date(generatedAtArg ?? DEFAULT_GENERATED_AT);
if (Number.isNaN(generatedAt.getTime())) {
throw new Error(`Invalid --generated-at value: ${generatedAtArg}`);
}
const result = await generateReferenceCompanionApps({
outputDir,
gatewayUrl,
generatedAt,
});
console.log(`Generated companion reference apps in ${result.rootDir}`);
@@ -28,6 +36,7 @@ async function main(): Promise<void> {
}
console.log(`- macos-app: ${result.macosMenuBarAppDir}`);
console.log(`- readme: ${result.readmePath}`);
console.log(`- generatedAt: ${generatedAt.toISOString()}`);
}
main().catch((error: unknown) => {