From ebc18803126167346468e18ec52855f4a34966b1 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Thu, 19 Dec 2024 14:29:21 +0100 Subject: [PATCH] Move compiler option to emit declarations to tsconfig.base.json (#1371) --- packages/connect-conformance/package.json | 4 ++-- packages/connect-express/package.json | 4 ++-- packages/connect-fastify/package.json | 4 ++-- packages/connect-next/package.json | 4 ++-- packages/connect-node/package.json | 4 ++-- packages/connect-web/package.json | 4 ++-- packages/connect/package.json | 4 ++-- tsconfig.base.json | 8 +++++--- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/connect-conformance/package.json b/packages/connect-conformance/package.json index 3d3c9b08d..cba7bab4f 100644 --- a/packages/connect-conformance/package.json +++ b/packages/connect-conformance/package.json @@ -19,8 +19,8 @@ "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", "postbuild": "connectconformance --version", - "build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/src/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs && echo >./dist/cjs/src/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm", "format": "prettier --write --ignore-unknown '.' '!dist' '!src/gen'", "license-header": "license-header", "lint": "eslint --max-warnings 0 .", diff --git a/packages/connect-express/package.json b/packages/connect-express/package.json index f2cce5695..304a48527 100644 --- a/packages/connect-express/package.json +++ b/packages/connect-express/package.json @@ -10,8 +10,8 @@ "scripts": { "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm", "test": "jasmine --config=jasmine.json", "conformance": "tsc --noEmit && connectconformance --mode server --conf ./conformance/conformance-express.yaml -v -- tsx ./conformance/server.ts", "format": "prettier --write --ignore-unknown '.' '!dist'", diff --git a/packages/connect-fastify/package.json b/packages/connect-fastify/package.json index 20c0dd02b..ea9eb942b 100644 --- a/packages/connect-fastify/package.json +++ b/packages/connect-fastify/package.json @@ -10,8 +10,8 @@ "scripts": { "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm", "conformance": "tsc --noEmit && connectconformance --mode server --conf ./conformance/conformance-fastify.yaml -v -- tsx ./conformance/server.ts", "format": "prettier --write --ignore-unknown '.' '!dist'", "license-header": "license-header", diff --git a/packages/connect-next/package.json b/packages/connect-next/package.json index 6594f29b6..f317f12fc 100644 --- a/packages/connect-next/package.json +++ b/packages/connect-next/package.json @@ -10,8 +10,8 @@ "scripts": { "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm", "format": "prettier --write --ignore-unknown '.' '!dist'", "license-header": "license-header", "lint": "eslint --max-warnings 0 .", diff --git a/packages/connect-node/package.json b/packages/connect-node/package.json index 8deefd6aa..5d64df96b 100644 --- a/packages/connect-node/package.json +++ b/packages/connect-node/package.json @@ -10,8 +10,8 @@ "scripts": { "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc --project tsconfig.build.json --module commonjs --moduleResolution node10 --verbatimModuleSyntax false --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.build.json --module commonjs --moduleResolution node10 --verbatimModuleSyntax false --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm", "test": "jasmine --config=jasmine.json", "conformance:server": "tsc --noEmit && connectconformance --mode server --conf ./conformance/conformance-node.yaml -v -- tsx ./conformance/server.ts", "conformance:client": "tsc --noEmit && connectconformance --mode client --conf ./conformance/conformance-node.yaml -v -- tsx ./conformance/client.ts", diff --git a/packages/connect-web/package.json b/packages/connect-web/package.json index 33f29f4b1..c8da2a066 100644 --- a/packages/connect-web/package.json +++ b/packages/connect-web/package.json @@ -10,8 +10,8 @@ "scripts": { "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.build.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.build.json --outDir ./dist/esm", "conformance:safari": "npm run conformance:safari:promise && npm run conformance:client:safari:callback", "conformance:safari:promise": "connectconformance --mode client --conf conformance/conformance-web.yaml -- tsx conformance/client.ts --browser safari", "conformance:safari:callback": "connectconformance --mode client --conf conformance/conformance-web.yaml -- tsx conformance/client.ts --browser safari --useCallbackClient", diff --git a/packages/connect/package.json b/packages/connect/package.json index 9ed0d2d09..1a84a0527 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -13,8 +13,8 @@ "postgenerate": "license-header src/protocol-grpc/gen", "prebuild": "rm -rf ./dist/*", "build": "npm run build:cjs && npm run build:esm", - "build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm", "postbuild": "node scripts/update-user-agent.mjs", "test": "jasmine --config=jasmine.json", "format": "prettier --write --ignore-unknown '.' '!dist' '!src/protocol-grpc/gen'", diff --git a/tsconfig.base.json b/tsconfig.base.json index 34b011d1a..9c914be0f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -8,9 +8,12 @@ // ES2018.AsyncIterable for AsyncIterator "ES2018.AsyncIterable" ], + "declaration": true, + // We don't have dependencies that require interop "esModuleInterop": false, - "forceConsistentCasingInFileNames": true, + // As strict as possible "strict": true, + "forceConsistentCasingInFileNames": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, @@ -22,8 +25,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noImplicitOverride": true, - - // We need node's module resolution, so we do not have to skip lib checks + // We're building with Node16 module resolution "moduleResolution": "Node16", "module": "Node16", "verbatimModuleSyntax": true,