diff --git a/.changeset/chilled-bananas-poke.md b/.changeset/chilled-bananas-poke.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/chilled-bananas-poke.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/package.json b/package.json index 08159e95b1c..adc138baaaf 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "license": "MIT", "scripts": { "build": "FORCE_COLOR=1 turbo build --concurrency=${TURBO_CONCURRENCY:-80%}", + "build:declarations": "FORCE_COLOR=1 turbo build:declarations --concurrency=${TURBO_CONCURRENCY:-80%} --filter=@clerk/nextjs --filter=@clerk/clerk-react --filter=@clerk/shared --filter=@clerk/types", "bundlewatch": "turbo bundlewatch", "changeset": "changeset", "changeset:empty": "pnpm changeset --empty", diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json index f11d7b36ca9..38f85bab2bc 100644 --- a/packages/backend/tsconfig.json +++ b/packages/backend/tsconfig.json @@ -2,8 +2,6 @@ "compilerOptions": { "allowSyntheticDefaultImports": true, "baseUrl": ".", - "declaration": true, - "declarationMap": false, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "importHelpers": true, diff --git a/packages/elements/package.json b/packages/elements/package.json index 5fe9fa14d3f..95902195a0d 100644 --- a/packages/elements/package.json +++ b/packages/elements/package.json @@ -60,7 +60,7 @@ "app:lint": "(cd examples/nextjs && pnpm lint)", "build": "tsup --env.NODE_ENV production", "build:analyze": "tsup --env.NODE_ENV production --metafile; open https://esbuild.github.io/analyze/", - "build:declarations": "tsc --env.NODE_ENV production -p tsconfig.json", + "build:declarations": "tsc -p tsconfig.declarations.json", "dev": "tsup --env.NODE_ENV development --watch", "dev:example": "concurrently \"pnpm dev\" \"pnpm app:dev\"", "dev:theme-builder": "TURBO_UI=0 concurrently --prefix-colors auto --names \"elements,ui,theme-builder\" \"turbo dev --filter=@clerk/elements\" \"pnpm dev -w @clerk/ui\" \"cd ../ui/theme-builder && pnpm dev\"", diff --git a/packages/nextjs/tsconfig.json b/packages/nextjs/tsconfig.json index 11f92d1c109..3e6c40dc969 100644 --- a/packages/nextjs/tsconfig.json +++ b/packages/nextjs/tsconfig.json @@ -2,8 +2,6 @@ "compilerOptions": { "allowJs": true, "baseUrl": ".", - "declaration": true, - "declarationMap": true, "esModuleInterop": true, "importHelpers": true, "isolatedModules": true, diff --git a/packages/react/package.json b/packages/react/package.json index 779fc420eef..bf2c720319d 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -64,6 +64,7 @@ "scripts": { "build": "tsup", "postbuild": "node ../../scripts/subpath-workaround.mjs react", + "build:declarations": "tsc -p tsconfig.declarations.json", "clean": "rimraf ./dist", "dev": "tsup --watch", "dev:publish": "pnpm dev --env.publish", diff --git a/packages/react/tsconfig.declarations.json b/packages/react/tsconfig.declarations.json new file mode 100644 index 00000000000..b97a0330a47 --- /dev/null +++ b/packages/react/tsconfig.declarations.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationDir": "./dist", + "declarationMap": true, + "emitDeclarationOnly": true, + "skipLibCheck": true + }, + "exclude": ["**/__tests__/**/*"] +} diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 90e5d8cc9b4..fe00399fb13 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,10 +1,7 @@ { "compilerOptions": { "baseUrl": ".", - "declaration": true, - "declarationMap": false, "esModuleInterop": true, - "emitDeclarationOnly": true, "importHelpers": true, "isolatedModules": true, "jsx": "react", diff --git a/packages/shared/package.json b/packages/shared/package.json index fa7b8ba7d4b..4b53bb2b578 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -122,6 +122,7 @@ "scripts": { "build": "tsup", "postbuild": "node ../../scripts/subpath-workaround.mjs shared", + "build:declarations": "tsc -p tsconfig.declarations.json", "clean": "rimraf ./dist", "dev": "tsup --watch", "dev:publish": "pnpm dev -- --env.publish", diff --git a/packages/shared/tsconfig.declarations.json b/packages/shared/tsconfig.declarations.json new file mode 100644 index 00000000000..b97a0330a47 --- /dev/null +++ b/packages/shared/tsconfig.declarations.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationDir": "./dist", + "declarationMap": true, + "emitDeclarationOnly": true, + "skipLibCheck": true + }, + "exclude": ["**/__tests__/**/*"] +} diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index f120c796cd0..c791a8f0a33 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -9,12 +9,8 @@ "preserveWatchOutput": true, "skipLibCheck": true, "strict": true, - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true, "outDir": "dist", "resolveJsonModule": true, - "declarationDir": "dist/types", "jsx": "react", "lib": ["ES6", "DOM", "WebWorker"], "allowJs": true diff --git a/packages/types/package.json b/packages/types/package.json index ce9bb04f6a4..72d6c7c3f0f 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -31,6 +31,7 @@ ], "scripts": { "build": "tsup --env.NODE_ENV production", + "build:declarations": "tsc -p tsconfig.declarations.json", "clean": "rimraf ./dist", "dev": "tsup --watch", "lint": "eslint src" diff --git a/packages/types/tsconfig.declarations.json b/packages/types/tsconfig.declarations.json new file mode 100644 index 00000000000..b97a0330a47 --- /dev/null +++ b/packages/types/tsconfig.declarations.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationDir": "./dist", + "declarationMap": true, + "emitDeclarationOnly": true, + "skipLibCheck": true + }, + "exclude": ["**/__tests__/**/*"] +} diff --git a/turbo.json b/turbo.json index 6d7bdb5ae37..4b08a1e7b17 100644 --- a/turbo.json +++ b/turbo.json @@ -60,6 +60,12 @@ "outputLogs": "new-only", "outputs": ["*/package.json", "dist/**", "scripts/**"] }, + "build:declarations": { + "dependsOn": ["build"], + "inputs": ["tsconfig.declarations.json"], + "outputLogs": "new-only", + "outputs": ["dist/**/*.d.ts", "dist/**/*.d.ts.map"] + }, "dev": { "cache": false },