Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

vite.config.ts

64 lines1.8 KB

1import "vite-plus/test/config";
2import { defineConfig, mergeConfig } from "vite-plus";
3​
4import baseConfig from "../../vite.config.ts";
5import { loadRepoEnv } from "../../scripts/lib/public-config.ts";
6​
7const bundledPackagePrefixes = [
8 "@pierre/diffs",
9 "@t3tools/",
10 "effect-acp",
11 "effect-codex-app-server",
12];
13​
14export function shouldBundleCliDependency(id: string): boolean {
15 return bundledPackagePrefixes.some((prefix) => id.startsWith(prefix));
17​
18const repoEnv = loadRepoEnv();
19​
20export default mergeConfig(
21 baseConfig,
22 defineConfig({
23 run: {
24 tasks: {
25 build: {
26 command: "node scripts/cli.ts build",
27 dependsOn: ["@t3tools/web#build"],
28 cache: false,
29 },
30 },
31 },
32 pack: {
33 entry: ["src/bin.ts"],
34 outDir: "dist",
35 sourcemap: true,
36 clean: true,
37 deps: {
38 alwaysBundle: shouldBundleCliDependency,
39 onlyBundle: false,
40 },
41 banner: {
42 js: "#!/usr/bin/env node\n",
43 },
44 define: {
45 __T3CODE_BUILD_RELAY_URL__: JSON.stringify(repoEnv.T3CODE_RELAY_URL?.trim() ?? ""),
46 __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__: JSON.stringify(
47 repoEnv.T3CODE_CLERK_PUBLISHABLE_KEY?.trim() ?? "",
48 ),
49 __T3CODE_BUILD_CLERK_CLI_OAUTH_CLIENT_ID__: JSON.stringify(
50 repoEnv.T3CODE_CLERK_CLI_OAUTH_CLIENT_ID?.trim() ?? "",
51 ),
52 },
53 },
54 test: {
55 // The server suite exercises sqlite, git, temp worktrees, and orchestration
56 // runtimes heavily. Running files in parallel introduces load-sensitive flakes.
57 fileParallelism: false,
58 // Server integration tests exercise sqlite, git, and orchestration together.
59 // Under package-wide runs they can exceed the default budget on loaded CI hosts.
60 hookTimeout: 120_000,
61 testTimeout: 120_000,
62 },
63 }),
64);