- add 3Y/5Y/10Y financial history filtering and reorganize normalization details UI - add new fiscal taxonomy surface/income bridge/KPI packs and update Rust taxonomy loading - auto-detect Homebrew SQLite for native `sqlite-vec` in local dev/e2e with docs and env guidance
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import { spawn } from "node:child_process";
|
|
import { mkdirSync } from "node:fs";
|
|
import {
|
|
prepareE2eDatabase,
|
|
E2E_DATABASE_PATH,
|
|
E2E_WORKFLOW_DATA_DIR,
|
|
} from "./e2e-prepare";
|
|
import { applyLocalSqliteVectorEnv } from "./sqlite-vector-env";
|
|
|
|
const host = process.env.PLAYWRIGHT_HOST ?? "127.0.0.1";
|
|
const port = process.env.PLAYWRIGHT_PORT ?? "3400";
|
|
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? `http://${host}:${port}`;
|
|
const initialEnv: NodeJS.ProcessEnv = {
|
|
...process.env,
|
|
BETTER_AUTH_BASE_URL: baseURL,
|
|
BETTER_AUTH_SECRET: "playwright-e2e-secret-playwright-e2e-secret",
|
|
BETTER_AUTH_TRUSTED_ORIGINS: baseURL,
|
|
DATABASE_URL: `file:${E2E_DATABASE_PATH}`,
|
|
HOSTNAME: host,
|
|
NEXT_PUBLIC_API_URL: "",
|
|
PORT: port,
|
|
SEC_USER_AGENT: "Fiscal Clone Playwright <support@fiscal.local>",
|
|
WORKFLOW_LOCAL_DATA_DIR: E2E_WORKFLOW_DATA_DIR,
|
|
WORKFLOW_LOCAL_QUEUE_CONCURRENCY: "1",
|
|
WORKFLOW_TARGET_WORLD: "local",
|
|
};
|
|
const { config: sqliteVectorConfig, env } =
|
|
applyLocalSqliteVectorEnv(initialEnv);
|
|
|
|
delete env.NO_COLOR;
|
|
|
|
prepareE2eDatabase();
|
|
mkdirSync(E2E_WORKFLOW_DATA_DIR, { recursive: true });
|
|
if (sqliteVectorConfig.mode === "native") {
|
|
console.info(
|
|
`[e2e] sqlite-vec native extension enabled (${sqliteVectorConfig.sqliteLibPath})`,
|
|
);
|
|
}
|
|
|
|
const child = spawn(
|
|
"bun",
|
|
["--bun", "next", "dev", "--turbopack", "--hostname", host, "--port", port],
|
|
{
|
|
stdio: "inherit",
|
|
env,
|
|
},
|
|
);
|
|
|
|
function forwardSignal(signal: NodeJS.Signals) {
|
|
if (!child.killed) {
|
|
child.kill(signal);
|
|
}
|
|
}
|
|
|
|
process.on("SIGINT", () => forwardSignal("SIGINT"));
|
|
process.on("SIGTERM", () => forwardSignal("SIGTERM"));
|
|
|
|
child.on("exit", (code, signal) => {
|
|
if (signal) {
|
|
process.exit(signal === "SIGINT" || signal === "SIGTERM" ? 0 : 1);
|
|
return;
|
|
}
|
|
|
|
process.exit(code ?? 0);
|
|
});
|