import { testRunPath, testRunRoot } from "./run-isolation.ts"; /** * The static workshop a Playwright config serves: the workshop tests * (playwright.storybook.config.ts) and the gallery goldens * (playwright.visual.config.ts) open the same build. * * 1105/12-04. Under TEST_RUN_ID the workshop is built into the run's own * folder (.tmp/runs//artifacts/storybook/static) with build:storybook's * two steps and another output folder. Unset, the gate's build:storybook * writes artifacts/storybook/static. */ export function storybookStaticServer(port: number): Readonly<{ directory: string; command: string; }> { const directory = testRunPath("artifacts/storybook/static"); const build = testRunRoot() === "." ? "corepack pnpm build:storybook" : "node scripts/generate-product-feature-index.ts && " + `corepack pnpm exec storybook build -o ${directory}`; return Object.freeze({ directory, command: `${build} && node scripts/serve-static.ts ${directory} ${port}`, }); }