add timeline header

This commit is contained in:
2026-03-07 08:14:32 +01:00
parent dc524cad24
commit 724980fd31
9 changed files with 164 additions and 88 deletions

View File

@@ -1,6 +1,14 @@
import { cpSync, readFileSync, writeFileSync } from "node:fs";
import {
copyFileSync,
cpSync,
existsSync,
readFileSync,
realpathSync,
writeFileSync,
} from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { execFileSync } from "node:child_process";
const __dirname = dirname(fileURLToPath(import.meta.url));
const src = resolve(__dirname, "../build/web");
@@ -9,6 +17,22 @@ const dest = resolve(__dirname, "../../../apps/web/public/flutter");
cpSync(src, dest, { recursive: true });
console.log(`Copied Flutter build: ${src}${dest}`);
// Copy flutter.js.map from the Flutter SDK (not included in build output)
const flutterBin = execFileSync("which", ["flutter"], {
encoding: "utf-8",
}).trim();
const sdkBinDir = dirname(realpathSync(flutterBin));
const flutterJsMap = resolve(
sdkBinDir,
"cache/flutter_web_sdk/flutter_js/flutter.js.map",
);
if (existsSync(flutterJsMap)) {
copyFileSync(flutterJsMap, resolve(dest, "flutter.js.map"));
console.log("Copied flutter.js.map from SDK");
} else {
console.warn(`flutter.js.map not found at ${flutterJsMap}`);
}
// Extract buildConfig from flutter_bootstrap.js so the React app can fetch it
const bootstrap = readFileSync(resolve(dest, "flutter_bootstrap.js"), "utf-8");
const match = bootstrap.match(/_flutter\.buildConfig\s*=\s*({.*?});/);