← Files Biological Sequence & Alignment ViewerARCHIVED FILE

e2e/build-harness.mjs

911 Bytes · Sep 30, 2026 · 23:01 UTC

↓ Download file

import { readFile, realpath, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";

import { resolveSequenceViewerRuntimeRoot } from "./plugin-runtime-root.mjs";

const sourceRoot = await realpath(
  path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."),
);
const { runtimeRoot } = await resolveSequenceViewerRuntimeRoot(sourceRoot);
const { createSequenceViewerHtml } = await import(
  pathToFileURL(path.join(runtimeRoot, "dist/server.mjs")).href
);

const [appJavaScriptGzip, styles] = await Promise.all([
  readFile(path.join(runtimeRoot, "dist/views/app.js.gz")),
  readFile(path.join(runtimeRoot, "dist/views/styles.css"), "utf8"),
]);
await writeFile(
  path.join(sourceRoot, "e2e/generated-viewer.html"),
  createSequenceViewerHtml({
    appJavaScriptGzipBase64: appJavaScriptGzip.toString("base64"),
    styles,
  }),
);

SHA-256: a5f9bd5cd3d37a259214ae6fec8714b6a6bb81e059d7024d1baa34e429c067f1