Skip to content

Commit dbf469d

Browse files
authored
feat: add centralized TypeScript configuration package (#2096)
1 parent d306651 commit dbf469d

28 files changed

+347
-273
lines changed

apps/api/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ COPY ./apps/api/package.json ./package.json
2222
# Workspace dependencies like "workspace:*" or "workspace:^1.0.0" cannot be resolved
2323
# inside Docker since the workspace packages aren't available in the container context.
2424
# This jq command filters out any dependency where the version starts with "workspace:"
25-
# Example: "core": "workspace:*" gets removed, "zod": "4.0.5" remains
26-
RUN jq '.dependencies |= with_entries(select(.value | startswith("workspace:") | not))' \
25+
# from both dependencies and devDependencies sections
26+
RUN jq '.dependencies |= with_entries(select(.value | startswith("workspace:") | not)) | \
27+
.devDependencies |= with_entries(select(.value | startswith("workspace:") | not))' \
2728
package.json > package.tmp.json && \
2829
mv package.tmp.json package.json
2930

apps/api/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ const appRouter = router({
2424
// HTTP router
2525
const app = new Hono<AppContext>();
2626

27+
// Root endpoint with API information
28+
app.get("/", (c) => {
29+
return c.json({
30+
name: "@repo/api",
31+
version: "0.0.0",
32+
endpoints: {
33+
trpc: "/api/trpc",
34+
auth: "/api/auth",
35+
health: "/health",
36+
},
37+
documentation: {
38+
trpc: "https://trpc.io",
39+
auth: "https://www.better-auth.com",
40+
},
41+
});
42+
});
43+
44+
// Health check endpoint
45+
app.get("/health", (c) => {
46+
return c.json({ status: "healthy", timestamp: new Date().toISOString() });
47+
});
48+
2749
/*
2850
* Middleware for initializing database and authentication services.
2951
*

apps/api/package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,33 @@
99
"./package.json": "./package.json"
1010
},
1111
"scripts": {
12-
"dev": "bun run --env-file ../../.env --env-file ../../.env.local ./start.ts",
12+
"dev": "bun run --watch --env-file ../../.env --env-file ../../.env.local ./start.ts",
1313
"build": "bun build index.ts --outdir dist --target bun",
1414
"test": "vitest",
1515
"typecheck": "tsc --noEmit"
1616
},
1717
"dependencies": {
18-
"@ai-sdk/openai": "^2.0.2",
18+
"@ai-sdk/openai": "^2.0.6",
1919
"@repo/core": "workspace:*",
2020
"@repo/db": "workspace:*",
2121
"@trpc/server": "^11.4.4",
22-
"ai": "^5.0.2",
22+
"ai": "^5.0.8",
2323
"better-auth": "^1.3.4",
2424
"dataloader": "^2.2.3",
2525
"drizzle-orm": "^0.44.4",
2626
"postgres": "^3.4.7"
2727
},
2828
"peerDependencies": {
29-
"hono": "^4.8.12",
30-
"zod": "^4.0.14"
29+
"hono": "^4.9.0",
30+
"zod": "^4.0.15"
3131
},
3232
"devDependencies": {
33-
"@cloudflare/workers-types": "^4.20250805.0",
33+
"@cloudflare/workers-types": "^4.20250807.0",
34+
"@repo/typescript-config": "workspace:*",
3435
"@types/bun": "^1.2.19",
35-
"hono": "^4.8.12",
36-
"typescript": "~5.8.3",
36+
"hono": "^4.9.0",
37+
"typescript": "~5.9.2",
3738
"vitest": "~3.2.4",
38-
"zod": "^4.0.14"
39+
"zod": "^4.0.15"
3940
}
4041
}

apps/api/start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const app = new Hono<AppContext>();
4949
* - Provides access to all Cloudflare bindings defined in wrangler.jsonc
5050
*/
5151
const cf = await getPlatformProxy<CloudflareEnv>({
52-
configPath: "../../wrangler.jsonc",
52+
configPath: "../edge/wrangler.jsonc",
5353
persist: true,
5454
});
5555

apps/api/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../packages/typescript-config/node.jsonc",
33
"compilerOptions": {
44
"composite": true,
55
"declaration": true,
66
"declarationMap": true,
7-
"module": "ESNext",
8-
"moduleResolution": "Bundler",
97
"noEmit": false,
108
"outDir": "./dist",
119
"types": ["@cloudflare/workers-types", "bun"]

apps/edge/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@
1717
"@repo/db": "workspace:*",
1818
"@trpc/server": "^11.4.4",
1919
"better-auth": "^1.3.4",
20-
"hono": "^4.8.12",
21-
"zod": "^4.0.14"
20+
"hono": "^4.9.0",
21+
"zod": "^4.0.15"
2222
},
2323
"peerDependencies": {
24-
"@cloudflare/workers-types": "^4.20250805.0"
24+
"@cloudflare/workers-types": "^4.20250807.0"
2525
},
2626
"peerDependenciesMeta": {
2727
"@cloudflare/workers-types": {
2828
"optional": true
2929
}
3030
},
3131
"devDependencies": {
32-
"@cloudflare/vite-plugin": "^1.11.1",
33-
"@cloudflare/vitest-pool-workers": "^0.8.60",
34-
"@cloudflare/workers-types": "^4.20250805.0",
32+
"@cloudflare/vite-plugin": "^1.11.2",
33+
"@cloudflare/vitest-pool-workers": "^0.8.61",
34+
"@cloudflare/workers-types": "^4.20250807.0",
3535
"@hono/vite-build": "^1.7.0",
36+
"@repo/typescript-config": "workspace:*",
3637
"@types/bun": "^1.2.19",
3738
"typescript": "~5.8.3",
3839
"vite": "~7.0.6",

apps/edge/tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../packages/typescript-config/cloudflare.jsonc",
33
"compilerOptions": {
4-
"lib": ["ESNext"],
4+
"composite": true,
5+
"declaration": true,
6+
"noEmit": false,
57
"outDir": "./dist",
68
"types": ["@cloudflare/workers-types", "vite/client"]
79
},

apps/web/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@
2929
"jotai": "^2.13.0",
3030
"jotai-effect": "^2.0.5",
3131
"localforage": "^1.10.0",
32-
"lucide-react": "^0.535.0",
32+
"lucide-react": "^0.536.0",
3333
"react": "^19.1.1",
3434
"react-dom": "^19.1.1",
3535
"tailwind-merge": "^3.3.1"
3636
},
3737
"devDependencies": {
38+
"@repo/typescript-config": "workspace:*",
3839
"@tailwindcss/postcss": "^4.1.11",
3940
"@tanstack/router-devtools": "^1.130.13",
40-
"@tanstack/router-plugin": "^1.130.15",
41+
"@tanstack/router-plugin": "^1.130.16",
4142
"@types/bun": "^1.2.19",
4243
"@types/node": "^24.2.0",
4344
"@types/react": "^19.1.9",
@@ -52,8 +53,9 @@
5253
"postcss": "^8.5.6",
5354
"tailwindcss": "^4.1.11",
5455
"tw-animate-css": "^1.3.6",
55-
"typescript": "~5.8.3",
56-
"vite": "~7.0.6",
56+
"typescript": "~5.9.2",
57+
"vite": "~7.1.1",
58+
"vite-tsconfig-paths": "^5.1.4",
5759
"vitest": "~3.2.4"
5860
}
5961
}

apps/web/tsconfig.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../packages/typescript-config/react.jsonc",
33
"compilerOptions": {
4-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
5-
"jsx": "react-jsx",
6-
"jsxImportSource": "react",
7-
"types": ["vite/client"],
8-
"outDir": "../../.cache/ts-app",
9-
"baseUrl": ".",
10-
"paths": {
11-
"@/*": ["./*"]
12-
}
4+
"composite": true,
5+
"noEmit": true,
6+
"tsBuildInfoFile": "../../.cache/tsconfig/web.tsbuildinfo"
137
},
148
"include": ["**/*.ts", "**/*.tsx", "**/*.json", "./global.d.ts"],
15-
"exclude": ["**/dist/**/*", "**/node_modules/**/*", "lib/routeTree.gen.ts"]
9+
"exclude": ["**/dist/**/*", "**/node_modules/**/*"],
10+
"references": [{ "path": "../api" }]
1611
}

apps/web/vite.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { tanstackRouter } from "@tanstack/router-plugin/vite";
55
import react from "@vitejs/plugin-react-swc";
66
import { URL, fileURLToPath } from "node:url";
77
import { loadEnv } from "vite";
8+
import tsconfigPaths from "vite-tsconfig-paths";
89
import { defineProject } from "vitest/config";
910

1011
const publicEnvVars = [
@@ -49,16 +50,14 @@ export default defineProject(({ mode }) => {
4950

5051
resolve: {
5152
conditions: ["module", "browser", "development|production"],
52-
alias: {
53-
"@": fileURLToPath(new URL(".", import.meta.url)),
54-
},
5553
},
5654

5755
css: {
5856
postcss: "./postcss.config.js",
5957
},
6058

6159
plugins: [
60+
tsconfigPaths(),
6261
tanstackRouter({
6362
routesDirectory: "./routes",
6463
generatedRouteTree: "./lib/routeTree.gen.ts",

0 commit comments

Comments
 (0)