@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 27 lines 1.08 KB
Raw
1 import * as Neon from "@alchemy.run/neon";
2 import * as Output from "alchemy/Output";
3 import * as Effect from "effect/Effect";
4 import { resources } from "./resources.ts";
5
6 export const website = Effect.fn(function* (api: Neon.Function) {
7 const { project, branch, uploads, auth, publicAssets } = yield* resources;
8 const web = yield* Neon.Website.Vite("Web", {
9 branch,
10 rootDir: "./web",
11 env: { VITE_API_URL: api.url, VITE_NEON_AUTH_URL: auth.baseUrl },
12 assets: { notFoundHandling: "single-page-application" },
13 });
14 if (!web.url) return yield* Effect.die(new Error("The website did not return a URL"));
15 const siteUrl = typeof web.url === "string" ? Output.literal(web.url) : web.url;
16 const origin = Output.map(siteUrl, (url: string | undefined) => new URL(url ?? "").origin);
17 yield* Neon.AuthTrustedDomain("WebOrigin", { auth, domain: origin });
18 return {
19 url: web.url,
20 apiUrl: api.url,
21 authUrl: auth.baseUrl,
22 projectId: project.projectId,
23 branchId: branch.branchId,
24 bucketName: uploads.bucketName,
25 publicBucketName: publicAssets.bucketName,
26 };
27 });