build(turbo): normalize workspace task graph
This commit is contained in:
parent
4fc89c4d3f
commit
ae6eabed6f
6 changed files with 136 additions and 31 deletions
|
|
@ -11,7 +11,6 @@
|
|||
"test": "vitest run",
|
||||
"test:unit": "vitest run",
|
||||
"test:e2e": "env -u NO_COLOR playwright test",
|
||||
"test:qa": "bun run check && bun run test:unit && bun run build && bun run test:e2e",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
"db:check": "drizzle-kit check"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export default defineConfig({
|
|||
timeout: 120_000,
|
||||
},
|
||||
{
|
||||
command: `cd ../.. && bun run build-storybook && STORYBOOK_STATIC_PORT=${storybookPort} bun apps/web/tests/e2e/storybook-server.ts`,
|
||||
command: `cd ../.. && STORYBOOK_STATIC_PORT=${storybookPort} bun apps/web/tests/e2e/storybook-server.ts`,
|
||||
url: storybookURL,
|
||||
reuseExistingServer: false,
|
||||
timeout: 120_000,
|
||||
|
|
|
|||
|
|
@ -18,10 +18,61 @@ describe("workspace boundaries", () => {
|
|||
|
||||
expect(packageJson.private).toBe(true);
|
||||
expect(packageJson.workspaces).toEqual(["apps/*", "packages/*"]);
|
||||
expect(packageJson.scripts?.build).toBe("turbo build");
|
||||
expect(packageJson.scripts?.build).toBe("turbo run build");
|
||||
expect(existsSync(join(root, "turbo.json"))).toBe(true);
|
||||
});
|
||||
|
||||
test("keeps release orchestration in the root turbo task graph", () => {
|
||||
const rootPackage = JSON.parse(
|
||||
readFileSync(join(root, "package.json"), "utf8"),
|
||||
) as {
|
||||
scripts?: Record<string, string>;
|
||||
};
|
||||
const webPackage = JSON.parse(
|
||||
readFileSync(join(root, "apps/web/package.json"), "utf8"),
|
||||
) as { scripts?: Record<string, string> };
|
||||
const turboConfig = JSON.parse(
|
||||
readFileSync(join(root, "turbo.json"), "utf8"),
|
||||
) as {
|
||||
globalDependencies?: string[];
|
||||
tasks?: Record<string, { env?: string[] }>;
|
||||
};
|
||||
|
||||
expect(rootPackage.scripts?.["test:qa"]).toBe(
|
||||
"turbo run check test:unit build @dimensionlab/ui#build-storybook @dimensionlab/web#test:e2e",
|
||||
);
|
||||
expect(webPackage.scripts).not.toHaveProperty("test:qa");
|
||||
expect(turboConfig.tasks).not.toHaveProperty("test:qa");
|
||||
expect(turboConfig.globalDependencies).toEqual(
|
||||
expect.arrayContaining(["bun.lock", "tsconfig.base.json"]),
|
||||
);
|
||||
expect(turboConfig.tasks?.["test:e2e"]?.env).toEqual(
|
||||
expect.arrayContaining([
|
||||
"CI",
|
||||
"PLAYWRIGHT_DATABASE_URL",
|
||||
"PLAYWRIGHT_PORT",
|
||||
"PLAYWRIGHT_STORYBOOK_PORT",
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test("lets turbo build Storybook before e2e serves the static artifact", () => {
|
||||
const playwrightConfig = readFileSync(
|
||||
join(root, "apps/web/playwright.config.ts"),
|
||||
"utf8",
|
||||
);
|
||||
const turboConfig = JSON.parse(
|
||||
readFileSync(join(root, "turbo.json"), "utf8"),
|
||||
) as {
|
||||
tasks?: Record<string, { dependsOn?: string[] }>;
|
||||
};
|
||||
|
||||
expect(playwrightConfig).not.toContain("bun run build-storybook");
|
||||
expect(turboConfig.tasks?.["test:e2e"]?.dependsOn).toEqual(
|
||||
expect.arrayContaining(["@dimensionlab/ui#build-storybook"]),
|
||||
);
|
||||
});
|
||||
|
||||
test("keeps the website app and reusable UI library as separate packages", () => {
|
||||
const webPackage = JSON.parse(
|
||||
readFileSync(join(root, "apps/web/package.json"), "utf8"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue