shelley/ui: fix build-info.json timestamp to be int64

Philip Zeyliger created

Prompt: in a new worktree, fetch, reset to origin/main, fix the warning here

$ shelley version
Warning: failed to parse build-info.json: json: cannot unmarshal string into Go struct field .timestamp of type int64

The embedfs.go staleness checker expects timestamp to be an int64
(Unix milliseconds), but build.js was writing an ISO string.

Fix by using Date.now() instead of new Date().toISOString() for the
timestamp field, matching what build-info.js already does. Also add
the srcDir field for consistency.

Change summary

ui/scripts/build.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Detailed changes

ui/scripts/build.js 🔗

@@ -54,7 +54,13 @@ async function build() {
     fs.copyFileSync('src/styles.css', 'dist/styles.css');
 
     // Write build info
-    const buildInfo = { timestamp: new Date().toISOString() };
+    // Get the absolute path to the src directory for staleness checking
+    const srcDir = new URL('../src', import.meta.url).pathname;
+    const buildInfo = {
+      timestamp: Date.now(),
+      date: new Date().toISOString(),
+      srcDir: srcDir,
+    };
     fs.writeFileSync('dist/build-info.json', JSON.stringify(buildInfo, null, 2));
 
     console.log('Build complete!');