Skip to content

Commit d999677

Browse files
authored
Exports types in the package (#76)
* build types in .server * move type build to a separate build:types command * Create tsconfig.build.json to export types for src but not test dir
1 parent 38531b5 commit d999677

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
"./package.json": "./package.json"
3030
},
3131
"scripts": {
32-
"build": "npm run build:server && npm run build:client",
32+
"build": "rm -rf ./.server && npm run build:server && npm run build:client && npm run build:types",
3333
"build:client": "NODE_ENV=${NODE_ENV:-production} webpack",
3434
"build:server": "babel --delete-dir-on-start --extensions \".js\",\".ts\" --ignore \"**/*.test.ts\" --copy-files --no-copy-ignored --source-maps --out-dir ./.server ./src",
35+
"build:types": "tsc -p tsconfig.build.json",
3536
"dev": "concurrently \"npm run client:watch\" \"npm run server:watch:dev\" --kill-others --names \"client,server\" --prefix-colors \"red.dim,blue.dim\"",
3637
"dev:debug": "concurrently \"npm run client:watch\" \"npm run server:watch:debug\" --kill-others --names \"client,server\" --prefix-colors \"red.dim,blue.dim\"",
3738
"format": "npm run format:check -- --write",

tsconfig.build.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"checkJs": true,
5+
"esModuleInterop": true,
6+
"module": "NodeNext",
7+
"resolveJsonModule": true,
8+
"skipLibCheck": true,
9+
"strict": true,
10+
"target": "es2022",
11+
"baseUrl": "./",
12+
"paths": {
13+
"~/*": ["./*"]
14+
},
15+
"types": ["@testing-library/jest-dom", "jest"],
16+
"declaration": true,
17+
"emitDeclarationOnly": true,
18+
"isolatedModules": true,
19+
"outDir": ".server",
20+
"rootDir": "./src"
21+
},
22+
"include": ["src/**/*"],
23+
"exclude": ["coverage", "node_modules", ".public", ".server", "**/*.test.*"]
24+
}

0 commit comments

Comments
 (0)