The best way to control Claude Code, Codex and more from any computer or phone

main
ts 85 lines 2.4 KB
Raw
1 import * as Prisma from "@alchemy.run/prisma";
2 import { expect, it } from "@alchemy.run/test";
3
4 const constructors = [
5 "Astro",
6 "Foldkit",
7 "Nextjs",
8 "Nuxt",
9 "Octane",
10 "ReactRouter",
11 "SolidStart",
12 "StaticSite",
13 "SvelteKit",
14 "TanStackStart",
15 "Vinext",
16 "Vite",
17 "Vocs",
18 "Waku",
19 ] as const;
20
21 const contracts = [
22 () =>
23 Prisma.Website.Vite("Web", {
24 vite: { outDir: "build", base: "/docs/" },
25 assets: { notFoundHandling: "single-page-application" },
26 }),
27 () => Prisma.Website.Astro("Blog", { astro: { output: "server", site: "https://example.com" } }),
28 () =>
29 Prisma.Website.Astro("Docs", {
30 astro: { output: "static" },
31 assets: { notFoundHandling: "404-page" },
32 }),
33 () => Prisma.Website.Nextjs("Web", { rootDir: "./app" }),
34 () =>
35 Prisma.Website.Vinext("Web", {
36 rootDir: "./app",
37 env: { GREETING: "hello" },
38 domain: "app.example.com",
39 memo: false,
40 dev: { port: 5173 },
41 compute: { destroyOldDeployment: true },
42 }),
43 () => Prisma.Website.Nuxt("Web", { nuxt: { app: { baseURL: "/docs/" } } }),
44 () => Prisma.Website.SvelteKit("Web", { kit: { paths: { base: "/docs" } } }),
45 () => Prisma.Website.Waku("Web", { waku: { srcDir: "src" } }),
46 () => Prisma.Website.Foldkit("Web"),
47 () => Prisma.Website.Octane("Web"),
48 () => Prisma.Website.ReactRouter("Web"),
49 () => Prisma.Website.SolidStart("Web"),
50 () => Prisma.Website.TanStackStart("Web"),
51 () => Prisma.Website.Vocs("Docs"),
52 () => Prisma.Website.StaticSite("Docs", { command: "bun run build", outdir: "public" }),
53 () =>
54 Prisma.Website.Vite("Web", {
55 project: Prisma.Project("Parent", { createDatabase: false }),
56 dev: { mode: "external", url: "http://localhost:5173" },
57 }),
58 () =>
59 Prisma.Website.Vite("Web", {
60 // @ts-expect-error SPA routing belongs in assets.notFoundHandling.
61 spa: true,
62 }),
63 () =>
64 Prisma.Website.Astro("Web", {
65 // @ts-expect-error Framework output belongs in the astro option bag.
66 output: "static",
67 }),
68 ];
69
70 it(
71 "exports every framework with the established Website prop vocabulary",
72 () => {
73 for (const name of constructors) expect(typeof Prisma.Website[name]).toBe("function");
74 expect(contracts.length).toBeGreaterThan(constructors.length);
75 },
76 {
77 tags: [
78 "unit",
79 "provider:prisma",
80 "provider:prisma:project",
81 "provider:prisma:website",
82 "local",
83 ],
84 },
85 );