Each workspace package had its exports map pointing `types` at `./dist/...d.ts` while `default` pointed at `./src/...ts`. The dist directory is a build artifact only refreshed when someone runs `pnpm build` in that package — meaning every other package in the monorepo typechecks against last week's type signatures. Concrete failure mode: contributor edits a function in packages/shared/src/utils/foo.ts (changes a parameter type, adds a new export, etc.), runs `pnpm typecheck` from root, sees green. The check actually validated against the stale dist/.d.ts. Real type errors stay invisible until CI builds shared first, by which point the diff is already pushed. Fix: point `types` at the same `src/` paths the runtime resolves to. TypeScript reads .ts source as types fine when consumers share the same TS version, which a monorepo guarantees. Verified end-to-end: adding a new export to shared and immediately typechecking @kan/api now picks it up without rebuilding shared, and breaking a return type immediately fails the consumer's typecheck. Applied to @kan/api, @kan/db, @kan/logger, @kan/shared. @kan/email is intentionally left as-is because its source is .tsx (JSX) — pointing types at .tsx would force every consumer to enable --jsx in their tsconfig, which is a worse cascade than the stale dist problem we're solving. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
75 lines
1.9 KiB
JSON
75 lines
1.9 KiB
JSON
{
|
|
"name": "@kan/api",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"exports": {
|
|
".": {
|
|
"types": "./src/index.ts",
|
|
"default": "./src/index.ts"
|
|
},
|
|
"./root": {
|
|
"types": "./src/root.ts",
|
|
"default": "./src/root.ts"
|
|
},
|
|
"./trpc": {
|
|
"types": "./src/trpc.ts",
|
|
"default": "./src/trpc.ts"
|
|
},
|
|
"./types": {
|
|
"types": "./src/types/router.types.ts",
|
|
"default": "./src/types/router.types.ts"
|
|
},
|
|
"./openapi": {
|
|
"types": "./src/openapi.ts",
|
|
"default": "./src/openapi.ts"
|
|
},
|
|
"./utils/rateLimit": {
|
|
"types": "./src/utils/rateLimit.ts",
|
|
"default": "./src/utils/rateLimit.ts"
|
|
},
|
|
"./utils/apiLogging": {
|
|
"types": "./src/utils/apiLogging.ts",
|
|
"default": "./src/utils/apiLogging.ts"
|
|
},
|
|
"./utils/permissions": {
|
|
"types": "./src/utils/permissions.ts",
|
|
"default": "./src/utils/permissions.ts"
|
|
}
|
|
},
|
|
"license": "GPL-3.0",
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"clean": "git clean -xdf .cache .turbo dist node_modules",
|
|
"dev": "tsc",
|
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
"lint": "eslint",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
|
|
},
|
|
"dependencies": {
|
|
"@kan/auth": "workspace:*",
|
|
"@kan/db": "workspace:*",
|
|
"@kan/email": "workspace:^",
|
|
"@kan/logger": "workspace:^",
|
|
"@kan/shared": "workspace:^",
|
|
"@kan/stripe": "workspace:^",
|
|
"@trpc/server": "catalog:",
|
|
"rate-limiter-flexible": "^9.0.1",
|
|
"superjson": "2.2.1",
|
|
"trpc-to-openapi": "^2.3.2",
|
|
"zod": "catalog:"
|
|
},
|
|
"devDependencies": {
|
|
"@kan/eslint-config": "workspace:*",
|
|
"@kan/prettier-config": "workspace:*",
|
|
"@kan/tsconfig": "workspace:*",
|
|
"eslint": "catalog:",
|
|
"prettier": "catalog:",
|
|
"typescript": "catalog:",
|
|
"vitest": "^3.0.0"
|
|
},
|
|
"prettier": "@kan/prettier-config"
|
|
}
|