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>
69 lines
1.8 KiB
JSON
69 lines
1.8 KiB
JSON
{
|
|
"name": "@kan/db",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"exports": {
|
|
".": {
|
|
"types": "./src/index.ts",
|
|
"default": "./src/index.ts"
|
|
},
|
|
"./client": {
|
|
"types": "./src/client.ts",
|
|
"default": "./src/client.ts"
|
|
},
|
|
"./schema": {
|
|
"types": "./src/schema/index.ts",
|
|
"default": "./src/schema/index.ts"
|
|
},
|
|
"./types/*": {
|
|
"types": "./src/types/*",
|
|
"default": "./src/types/*"
|
|
},
|
|
"./repository/*": {
|
|
"types": "./src/repository/*.ts",
|
|
"default": "./src/repository/*.ts"
|
|
},
|
|
"./redis": {
|
|
"types": "./src/redis.ts",
|
|
"default": "./src/redis.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",
|
|
"migrate": "pnpm with-env drizzle-kit migrate",
|
|
"push": "pnpm with-env drizzle-kit push",
|
|
"studio": "pnpm with-env drizzle-kit studio",
|
|
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
|
|
"with-env": "dotenv -e ../../.env --"
|
|
},
|
|
"dependencies": {
|
|
"@electric-sql/pglite": "^0.3.7",
|
|
"@kan/logger": "workspace:^",
|
|
"@kan/shared": "workspace:^",
|
|
"drizzle-orm": "^0.42.0",
|
|
"drizzle-zod": "^0.5.1",
|
|
"ioredis": "^5.9.2",
|
|
"pg": "^8.11.3",
|
|
"uuid": "^11.1.0",
|
|
"zod": "catalog:"
|
|
},
|
|
"devDependencies": {
|
|
"@kan/eslint-config": "workspace:*",
|
|
"@kan/prettier-config": "workspace:*",
|
|
"@kan/tsconfig": "workspace:*",
|
|
"@types/pg": "^8.10.9",
|
|
"dotenv-cli": "^7.4.4",
|
|
"drizzle-kit": "^0.28.1",
|
|
"eslint": "catalog:",
|
|
"prettier": "catalog:",
|
|
"typescript": "catalog:"
|
|
},
|
|
"prettier": "@kan/prettier-config"
|
|
}
|