Skip to content

Commit 92780ab

Browse files
committed
build: separate typechecking and build tsconfigs
This change separates the TypeScript configuration into two configurations: - `tsconfig.json`: Non-artifact-emitting configuration for development- time typechecking - `tsconfig.build.json`: Artifact-emitting configuration used to build the project This includes no functional changes and is simply setup for future typechecking improvements.
1 parent 886c796 commit 92780ab

File tree

5 files changed

+44
-14
lines changed

5 files changed

+44
-14
lines changed

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
},
3333
"scripts": {
3434
"_format": "prettier --loglevel=warn \"{src,tools,scripts,tests,.github}/**/*.{mjs,cjs,js,mts,md,yml,json,html,ts}\" \"*.{mjs,cjs,js,mts,yml,json,html,ts}\" \".*.{mjs,cjs,js,yml,json,html,ts}\" \"!CHANGELOG.md\" \"!**/*/package-lock.json\" \"!.github/**/*.md\"",
35+
"clean": "rm -rf dist/",
3536
"start": "node ./bin/run.js",
36-
"build": "tsc",
37-
"dev": "tsc --watch",
37+
"build": "tsc --project tsconfig.build.json",
38+
"dev": "tsc --project tsconfig.build.json --watch",
3839
"test": "npm run test:dev",
3940
"format": "npm run _format -- --write",
4041
"format:check": "npm run _format -- --check",
@@ -57,7 +58,8 @@
5758
"postinstall-pack": "node ./scripts/postinstall.js",
5859
"postinstall": "npm run build && node ./scripts/postinstall.js",
5960
"prepublishOnly": "node ./scripts/prepare-for-publish.js",
60-
"certs": "openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj \"/CN=localhost\" -extensions EXT -config certconf"
61+
"certs": "openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj \"/CN=localhost\" -extensions EXT -config certconf",
62+
"typecheck": "tsc"
6163
},
6264
"dependencies": {
6365
"@fastify/static": "7.0.4",
@@ -175,6 +177,7 @@
175177
"@types/content-type": "1.1.8",
176178
"@types/debug": "4.1.12",
177179
"@types/envinfo": "7.8.4",
180+
"@types/eslint-config-prettier": "^6.11.3",
178181
"@types/etag": "1.8.3",
179182
"@types/flush-write-stream": "1.0.2",
180183
"@types/folder-walker": "3.2.4",

tsconfig.base.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": ["@tsconfig/recommended", "@tsconfig/node18"],
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"downlevelIteration": true,
6+
"noEmit": true,
7+
"incremental": true,
8+
"typeRoots": ["node_modules/@types", "types"]
9+
},
10+
"exclude": ["**/__fixtures__/**", "dist/", "functions-templates/", "site/"]
11+
}

tsconfig.build.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"declarationMap": true,
6+
"noEmit": false,
7+
"outDir": "dist",
8+
"sourceMap": true
9+
},
10+
"include": ["src/**/*.ts"]
11+
}

tsconfig.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
{
2-
"extends": ["@tsconfig/recommended", "@tsconfig/node18"],
3-
"compilerOptions": {
4-
"allowJs": true,
5-
"declaration": true,
6-
"declarationMap": true,
7-
"downlevelIteration": true,
8-
"incremental": true,
9-
"outDir": "dist",
10-
"typeRoots": ["node_modules/@types", "types"]
11-
},
12-
"include": ["src/**/*.ts"]
2+
"extends": "./tsconfig.base.json",
3+
"exclude": ["**/__fixtures__/**", "dist/", "functions-templates/", "site/", "tests/"]
134
}

0 commit comments

Comments
 (0)