From 0b2af610ae4e257198d412727054380a8d011ab2 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Tue, 17 May 2022 14:19:07 +0800 Subject: [PATCH] refactor: use TS project references instead of running tsc multiple times --- packages/create-docusaurus/.npmignore | 2 +- packages/docusaurus-logger/.npmignore | 2 +- packages/docusaurus-mdx-loader/.npmignore | 2 +- packages/docusaurus-migrate/.npmignore | 2 +- .../.npmignore | 2 +- .../docusaurus-plugin-content-blog/.npmignore | 2 +- .../docusaurus-plugin-content-docs/.npmignore | 2 +- .../package.json | 2 +- .../src/plugin-content-docs.d.ts | 2 ++ .../src/types.ts | 2 -- .../tsconfig.client.json | 13 +++++++++++++ .../tsconfig.json | 9 +++++---- .../tsconfig.server.json | 13 +++++++++++++ .../docusaurus-plugin-content-pages/.npmignore | 2 +- packages/docusaurus-plugin-debug/.npmignore | 2 +- packages/docusaurus-plugin-debug/package.json | 2 +- .../tsconfig.client.json | 13 +++++++++++++ packages/docusaurus-plugin-debug/tsconfig.json | 9 +++++---- .../tsconfig.server.json | 13 +++++++++++++ .../.npmignore | 2 +- .../package.json | 2 +- .../tsconfig.client.json | 13 +++++++++++++ .../tsconfig.json | 9 +++++---- .../tsconfig.server.json | 13 +++++++++++++ .../docusaurus-plugin-google-gtag/.npmignore | 2 +- .../docusaurus-plugin-google-gtag/package.json | 2 +- .../tsconfig.client.json | 13 +++++++++++++ .../tsconfig.json | 9 +++++---- .../tsconfig.server.json | 13 +++++++++++++ .../docusaurus-plugin-ideal-image/.npmignore | 2 +- .../docusaurus-plugin-ideal-image/package.json | 6 +----- .../tsconfig.browser.json | 8 -------- .../tsconfig.client.json | 13 +++++++++++++ .../tsconfig.json | 8 +++++--- .../tsconfig.server.json | 13 +++++++++++-- packages/docusaurus-plugin-pwa/.npmignore | 2 +- packages/docusaurus-plugin-pwa/package.json | 5 +---- ...onfig.browser.json => tsconfig.client.json} | 7 ++++++- packages/docusaurus-plugin-pwa/tsconfig.json | 8 +++++--- .../docusaurus-plugin-pwa/tsconfig.server.json | 18 ++++++++++-------- packages/docusaurus-plugin-sitemap/.npmignore | 2 +- packages/docusaurus-preset-classic/.npmignore | 2 +- .../.npmignore | 2 +- packages/docusaurus-theme-classic/.npmignore | 2 +- packages/docusaurus-theme-common/.npmignore | 2 +- .../docusaurus-theme-live-codeblock/.npmignore | 2 +- .../package.json | 6 +----- .../tsconfig.client.json | 9 +++++++-- .../tsconfig.json | 9 +++++---- .../tsconfig.server.json | 13 ++++++++++--- .../docusaurus-theme-search-algolia/.npmignore | 2 +- .../package.json | 6 +----- .../tsconfig.client.json | 9 +++++++-- .../tsconfig.json | 8 +++++--- .../tsconfig.server.json | 12 ++++++++++-- .../docusaurus-theme-translations/.npmignore | 2 +- packages/docusaurus-utils-common/.npmignore | 2 +- .../docusaurus-utils-validation/.npmignore | 2 +- packages/docusaurus-utils/.npmignore | 2 +- packages/docusaurus/.npmignore | 2 +- packages/docusaurus/package.json | 4 ++-- packages/docusaurus/tsconfig.client.json | 12 ++++++------ packages/docusaurus/tsconfig.json | 11 ++++++++--- packages/docusaurus/tsconfig.server.json | 7 ++++--- packages/eslint-plugin/.npmignore | 2 +- packages/lqip-loader/.npmignore | 2 +- tsconfig.json | 2 +- 67 files changed, 276 insertions(+), 124 deletions(-) create mode 100644 packages/docusaurus-plugin-content-docs/tsconfig.client.json create mode 100644 packages/docusaurus-plugin-content-docs/tsconfig.server.json create mode 100644 packages/docusaurus-plugin-debug/tsconfig.client.json create mode 100644 packages/docusaurus-plugin-debug/tsconfig.server.json create mode 100644 packages/docusaurus-plugin-google-analytics/tsconfig.client.json create mode 100644 packages/docusaurus-plugin-google-analytics/tsconfig.server.json create mode 100644 packages/docusaurus-plugin-google-gtag/tsconfig.client.json create mode 100644 packages/docusaurus-plugin-google-gtag/tsconfig.server.json delete mode 100644 packages/docusaurus-plugin-ideal-image/tsconfig.browser.json create mode 100644 packages/docusaurus-plugin-ideal-image/tsconfig.client.json rename packages/docusaurus-plugin-pwa/{tsconfig.browser.json => tsconfig.client.json} (52%) diff --git a/packages/create-docusaurus/.npmignore b/packages/create-docusaurus/.npmignore index 1edc83766ff5..0bc0b32a6248 100644 --- a/packages/create-docusaurus/.npmignore +++ b/packages/create-docusaurus/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* __tests__ node_modules diff --git a/packages/docusaurus-logger/.npmignore b/packages/docusaurus-logger/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-logger/.npmignore +++ b/packages/docusaurus-logger/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-mdx-loader/.npmignore b/packages/docusaurus-mdx-loader/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-mdx-loader/.npmignore +++ b/packages/docusaurus-mdx-loader/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-migrate/.npmignore b/packages/docusaurus-migrate/.npmignore index ba8304029eb7..b3d2bb61f7d9 100644 --- a/packages/docusaurus-migrate/.npmignore +++ b/packages/docusaurus-migrate/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-client-redirects/.npmignore b/packages/docusaurus-plugin-client-redirects/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-client-redirects/.npmignore +++ b/packages/docusaurus-plugin-client-redirects/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-content-blog/.npmignore b/packages/docusaurus-plugin-content-blog/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-content-blog/.npmignore +++ b/packages/docusaurus-plugin-content-blog/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-content-docs/.npmignore b/packages/docusaurus-plugin-content-docs/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-content-docs/.npmignore +++ b/packages/docusaurus-plugin-content-docs/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-content-docs/package.json b/packages/docusaurus-plugin-content-docs/package.json index 697fcf7224ea..c02fc60957b0 100644 --- a/packages/docusaurus-plugin-content-docs/package.json +++ b/packages/docusaurus-plugin-content-docs/package.json @@ -12,7 +12,7 @@ }, "types": "src/plugin-content-docs.d.ts", "scripts": { - "build": "tsc", + "build": "tsc --build", "watch": "tsc --watch" }, "publishConfig": { diff --git a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts index 412a08cdb08f..1d7784c63fc7 100644 --- a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts +++ b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +/// + declare module '@docusaurus/plugin-content-docs' { import type {MDXOptions} from '@docusaurus/mdx-loader'; import type { diff --git a/packages/docusaurus-plugin-content-docs/src/types.ts b/packages/docusaurus-plugin-content-docs/src/types.ts index df3579b856d8..cb4506b20d1a 100644 --- a/packages/docusaurus-plugin-content-docs/src/types.ts +++ b/packages/docusaurus-plugin-content-docs/src/types.ts @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/// - import type {BrokenMarkdownLink, Tag} from '@docusaurus/utils'; import type { VersionMetadata, diff --git a/packages/docusaurus-plugin-content-docs/tsconfig.client.json b/packages/docusaurus-plugin-content-docs/tsconfig.client.json new file mode 100644 index 000000000000..46b6cfa6cd75 --- /dev/null +++ b/packages/docusaurus-plugin-content-docs/tsconfig.client.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "module": "esnext", + "jsx": "react-native", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src/client", "src/*.d.ts"] +} diff --git a/packages/docusaurus-plugin-content-docs/tsconfig.json b/packages/docusaurus-plugin-content-docs/tsconfig.json index f5902ba1089b..327ab65c7bbc 100644 --- a/packages/docusaurus-plugin-content-docs/tsconfig.json +++ b/packages/docusaurus-plugin-content-docs/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "incremental": true, - "tsBuildInfoFile": "./lib/.tsbuildinfo", - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-plugin-content-docs/tsconfig.server.json b/packages/docusaurus-plugin-content-docs/tsconfig.server.json new file mode 100644 index 000000000000..eb1b6945ac88 --- /dev/null +++ b/packages/docusaurus-plugin-content-docs/tsconfig.server.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/client", "**/__tests__/**"] +} diff --git a/packages/docusaurus-plugin-content-pages/.npmignore b/packages/docusaurus-plugin-content-pages/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-content-pages/.npmignore +++ b/packages/docusaurus-plugin-content-pages/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-debug/.npmignore b/packages/docusaurus-plugin-debug/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-debug/.npmignore +++ b/packages/docusaurus-plugin-debug/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-debug/package.json b/packages/docusaurus-plugin-debug/package.json index 9d3f2fd58a35..eb9ce3d41a4e 100644 --- a/packages/docusaurus-plugin-debug/package.json +++ b/packages/docusaurus-plugin-debug/package.json @@ -5,7 +5,7 @@ "main": "lib/index.js", "types": "src/plugin-debug.d.ts", "scripts": { - "build": "tsc && node copyUntypedFiles.mjs", + "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", "watch": "node copyUntypedFiles.mjs && tsc --watch" }, "publishConfig": { diff --git a/packages/docusaurus-plugin-debug/tsconfig.client.json b/packages/docusaurus-plugin-debug/tsconfig.client.json new file mode 100644 index 000000000000..e6b111f009ef --- /dev/null +++ b/packages/docusaurus-plugin-debug/tsconfig.client.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "module": "esnext", + "jsx": "react-native", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src/theme", "src/*.d.ts"] +} diff --git a/packages/docusaurus-plugin-debug/tsconfig.json b/packages/docusaurus-plugin-debug/tsconfig.json index f5902ba1089b..327ab65c7bbc 100644 --- a/packages/docusaurus-plugin-debug/tsconfig.json +++ b/packages/docusaurus-plugin-debug/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "incremental": true, - "tsBuildInfoFile": "./lib/.tsbuildinfo", - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-plugin-debug/tsconfig.server.json b/packages/docusaurus-plugin-debug/tsconfig.server.json new file mode 100644 index 000000000000..a9fbcbd26b00 --- /dev/null +++ b/packages/docusaurus-plugin-debug/tsconfig.server.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/theme"] +} diff --git a/packages/docusaurus-plugin-google-analytics/.npmignore b/packages/docusaurus-plugin-google-analytics/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-google-analytics/.npmignore +++ b/packages/docusaurus-plugin-google-analytics/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-google-analytics/package.json b/packages/docusaurus-plugin-google-analytics/package.json index 77f5c813de98..99531da0ac1f 100644 --- a/packages/docusaurus-plugin-google-analytics/package.json +++ b/packages/docusaurus-plugin-google-analytics/package.json @@ -8,7 +8,7 @@ "access": "public" }, "scripts": { - "build": "tsc", + "build": "tsc --build", "watch": "tsc --watch" }, "repository": { diff --git a/packages/docusaurus-plugin-google-analytics/tsconfig.client.json b/packages/docusaurus-plugin-google-analytics/tsconfig.client.json new file mode 100644 index 000000000000..5c3825405151 --- /dev/null +++ b/packages/docusaurus-plugin-google-analytics/tsconfig.client.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "module": "esnext", + "jsx": "react-native", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src/analytics.ts", "src/*.d.ts"] +} diff --git a/packages/docusaurus-plugin-google-analytics/tsconfig.json b/packages/docusaurus-plugin-google-analytics/tsconfig.json index f5902ba1089b..327ab65c7bbc 100644 --- a/packages/docusaurus-plugin-google-analytics/tsconfig.json +++ b/packages/docusaurus-plugin-google-analytics/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "incremental": true, - "tsBuildInfoFile": "./lib/.tsbuildinfo", - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-plugin-google-analytics/tsconfig.server.json b/packages/docusaurus-plugin-google-analytics/tsconfig.server.json new file mode 100644 index 000000000000..dff58444b4d0 --- /dev/null +++ b/packages/docusaurus-plugin-google-analytics/tsconfig.server.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/analytics.ts"] +} diff --git a/packages/docusaurus-plugin-google-gtag/.npmignore b/packages/docusaurus-plugin-google-gtag/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-google-gtag/.npmignore +++ b/packages/docusaurus-plugin-google-gtag/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-google-gtag/package.json b/packages/docusaurus-plugin-google-gtag/package.json index 854f6d2e87f8..169b2c962a7a 100644 --- a/packages/docusaurus-plugin-google-gtag/package.json +++ b/packages/docusaurus-plugin-google-gtag/package.json @@ -5,7 +5,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "build": "tsc", + "build": "tsc --build", "watch": "tsc --watch" }, "publishConfig": { diff --git a/packages/docusaurus-plugin-google-gtag/tsconfig.client.json b/packages/docusaurus-plugin-google-gtag/tsconfig.client.json new file mode 100644 index 000000000000..6b090f2c7a3a --- /dev/null +++ b/packages/docusaurus-plugin-google-gtag/tsconfig.client.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "module": "esnext", + "jsx": "react-native", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src/gtag.ts", "src/options.ts", "src/*.d.ts"] +} diff --git a/packages/docusaurus-plugin-google-gtag/tsconfig.json b/packages/docusaurus-plugin-google-gtag/tsconfig.json index f5902ba1089b..327ab65c7bbc 100644 --- a/packages/docusaurus-plugin-google-gtag/tsconfig.json +++ b/packages/docusaurus-plugin-google-gtag/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "incremental": true, - "tsBuildInfoFile": "./lib/.tsbuildinfo", - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-plugin-google-gtag/tsconfig.server.json b/packages/docusaurus-plugin-google-gtag/tsconfig.server.json new file mode 100644 index 000000000000..c2d73711e9b8 --- /dev/null +++ b/packages/docusaurus-plugin-google-gtag/tsconfig.server.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/gtag.ts"] +} diff --git a/packages/docusaurus-plugin-ideal-image/.npmignore b/packages/docusaurus-plugin-ideal-image/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-ideal-image/.npmignore +++ b/packages/docusaurus-plugin-ideal-image/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-ideal-image/package.json b/packages/docusaurus-plugin-ideal-image/package.json index 6f6c73d117c0..6449d75574fe 100644 --- a/packages/docusaurus-plugin-ideal-image/package.json +++ b/packages/docusaurus-plugin-ideal-image/package.json @@ -5,11 +5,7 @@ "main": "lib/index.js", "types": "src/plugin-ideal-image.d.ts", "scripts": { - "build": "yarn build:server && yarn build:browser && yarn build:copy && yarn build:format", - "build:server": "tsc --project tsconfig.server.json", - "build:browser": "tsc --project tsconfig.browser.json", - "build:copy": "node copyUntypedFiles.mjs", - "build:format": "prettier --config ../../.prettierrc --write \"lib/**/*.js\"" + "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-ideal-image/tsconfig.browser.json b/packages/docusaurus-plugin-ideal-image/tsconfig.browser.json deleted file mode 100644 index 3af8257cdf8d..000000000000 --- a/packages/docusaurus-plugin-ideal-image/tsconfig.browser.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "esnext", - "jsx": "react-native" - }, - "include": ["src/theme/", "src/*.d.ts"] -} diff --git a/packages/docusaurus-plugin-ideal-image/tsconfig.client.json b/packages/docusaurus-plugin-ideal-image/tsconfig.client.json new file mode 100644 index 000000000000..e6b111f009ef --- /dev/null +++ b/packages/docusaurus-plugin-ideal-image/tsconfig.client.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "module": "esnext", + "jsx": "react-native", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src/theme", "src/*.d.ts"] +} diff --git a/packages/docusaurus-plugin-ideal-image/tsconfig.json b/packages/docusaurus-plugin-ideal-image/tsconfig.json index 51aec434b257..327ab65c7bbc 100644 --- a/packages/docusaurus-plugin-ideal-image/tsconfig.json +++ b/packages/docusaurus-plugin-ideal-image/tsconfig.json @@ -1,8 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "lib": ["DOM", "ES2019"], - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-plugin-ideal-image/tsconfig.server.json b/packages/docusaurus-plugin-ideal-image/tsconfig.server.json index 1a463cd83a52..a9fbcbd26b00 100644 --- a/packages/docusaurus-plugin-ideal-image/tsconfig.server.json +++ b/packages/docusaurus-plugin-ideal-image/tsconfig.server.json @@ -1,4 +1,13 @@ { - "extends": "./tsconfig.json", - "include": ["src/*.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/theme"] } diff --git a/packages/docusaurus-plugin-pwa/.npmignore b/packages/docusaurus-plugin-pwa/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-pwa/.npmignore +++ b/packages/docusaurus-plugin-pwa/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-pwa/package.json b/packages/docusaurus-plugin-pwa/package.json index f904d38a701d..3bc6d0cd22ee 100644 --- a/packages/docusaurus-plugin-pwa/package.json +++ b/packages/docusaurus-plugin-pwa/package.json @@ -5,10 +5,7 @@ "main": "lib/index.js", "types": "src/plugin-pwa.d.ts", "scripts": { - "build": "yarn build:server && yarn build:browser && yarn build:copy", - "build:server": "tsc --project tsconfig.server.json", - "build:browser": "tsc --project tsconfig.browser.json", - "build:copy": "node copyUntypedFiles.mjs" + "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-pwa/tsconfig.browser.json b/packages/docusaurus-plugin-pwa/tsconfig.client.json similarity index 52% rename from packages/docusaurus-plugin-pwa/tsconfig.browser.json rename to packages/docusaurus-plugin-pwa/tsconfig.client.json index 147b109fe030..554aeae7b214 100644 --- a/packages/docusaurus-plugin-pwa/tsconfig.browser.json +++ b/packages/docusaurus-plugin-pwa/tsconfig.client.json @@ -1,6 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "rootDir": "src", + "outDir": "lib", "module": "esnext", "jsx": "react-native" }, diff --git a/packages/docusaurus-plugin-pwa/tsconfig.json b/packages/docusaurus-plugin-pwa/tsconfig.json index 51aec434b257..327ab65c7bbc 100644 --- a/packages/docusaurus-plugin-pwa/tsconfig.json +++ b/packages/docusaurus-plugin-pwa/tsconfig.json @@ -1,8 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "lib": ["DOM", "ES2019"], - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-plugin-pwa/tsconfig.server.json b/packages/docusaurus-plugin-pwa/tsconfig.server.json index 40f95c1d1c14..f1c2e17459be 100644 --- a/packages/docusaurus-plugin-pwa/tsconfig.server.json +++ b/packages/docusaurus-plugin-pwa/tsconfig.server.json @@ -1,10 +1,12 @@ { - "extends": "./tsconfig.json", - "include": ["src/*.ts"], - "exclude": [ - "src/theme/", - "src/*.d.ts", - "src/registerSw.ts", - "src/renderReloadPopup.tsx" - ] + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/theme/", "src/registerSw.ts", "src/renderReloadPopup.tsx"] } diff --git a/packages/docusaurus-plugin-sitemap/.npmignore b/packages/docusaurus-plugin-sitemap/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-plugin-sitemap/.npmignore +++ b/packages/docusaurus-plugin-sitemap/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-preset-classic/.npmignore b/packages/docusaurus-preset-classic/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-preset-classic/.npmignore +++ b/packages/docusaurus-preset-classic/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-remark-plugin-npm2yarn/.npmignore b/packages/docusaurus-remark-plugin-npm2yarn/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-remark-plugin-npm2yarn/.npmignore +++ b/packages/docusaurus-remark-plugin-npm2yarn/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-classic/.npmignore b/packages/docusaurus-theme-classic/.npmignore index 3e3575db0c5a..3f56a7b661b6 100644 --- a/packages/docusaurus-theme-classic/.npmignore +++ b/packages/docusaurus-theme-classic/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-common/.npmignore b/packages/docusaurus-theme-common/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-theme-common/.npmignore +++ b/packages/docusaurus-theme-common/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-live-codeblock/.npmignore b/packages/docusaurus-theme-live-codeblock/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-theme-live-codeblock/.npmignore +++ b/packages/docusaurus-theme-live-codeblock/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-live-codeblock/package.json b/packages/docusaurus-theme-live-codeblock/package.json index 2e7974942241..661b8b3cc45e 100644 --- a/packages/docusaurus-theme-live-codeblock/package.json +++ b/packages/docusaurus-theme-live-codeblock/package.json @@ -11,11 +11,7 @@ "access": "public" }, "scripts": { - "build": "yarn build:server && yarn build:client && yarn build:copy && yarn build:format", - "build:server": "tsc --project tsconfig.server.json", - "build:client": "tsc --project tsconfig.client.json", - "build:copy": "node copyUntypedFiles.mjs", - "build:format": "prettier --config ../../.prettierrc --write \"lib/**/*.js\"" + "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" }, "repository": { "type": "git", diff --git a/packages/docusaurus-theme-live-codeblock/tsconfig.client.json b/packages/docusaurus-theme-live-codeblock/tsconfig.client.json index 462a6376e3be..8259c3a3ca5b 100644 --- a/packages/docusaurus-theme-live-codeblock/tsconfig.client.json +++ b/packages/docusaurus-theme-live-codeblock/tsconfig.client.json @@ -1,8 +1,13 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "rootDir": "src", + "outDir": "lib", "module": "esnext", "jsx": "react-native" }, - "include": ["src/theme/", "src/*.d.ts", "src/custom-buble.ts"] + "include": ["src/theme", "src/*.d.ts", "src/custom-buble.ts"] } diff --git a/packages/docusaurus-theme-live-codeblock/tsconfig.json b/packages/docusaurus-theme-live-codeblock/tsconfig.json index f5902ba1089b..327ab65c7bbc 100644 --- a/packages/docusaurus-theme-live-codeblock/tsconfig.json +++ b/packages/docusaurus-theme-live-codeblock/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "incremental": true, - "tsBuildInfoFile": "./lib/.tsbuildinfo", - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-theme-live-codeblock/tsconfig.server.json b/packages/docusaurus-theme-live-codeblock/tsconfig.server.json index 2159e2ef8e20..00f4d4751b29 100644 --- a/packages/docusaurus-theme-live-codeblock/tsconfig.server.json +++ b/packages/docusaurus-theme-live-codeblock/tsconfig.server.json @@ -1,5 +1,12 @@ { - "extends": "./tsconfig.json", - "include": ["src/*.ts"], - "exclude": ["src/custom-buble.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/custom-buble.ts", "src/theme", "**/__tests__/**"] } diff --git a/packages/docusaurus-theme-search-algolia/.npmignore b/packages/docusaurus-theme-search-algolia/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-theme-search-algolia/.npmignore +++ b/packages/docusaurus-theme-search-algolia/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-search-algolia/package.json b/packages/docusaurus-theme-search-algolia/package.json index f1e3f6db96fb..2a809087b4cc 100644 --- a/packages/docusaurus-theme-search-algolia/package.json +++ b/packages/docusaurus-theme-search-algolia/package.json @@ -21,11 +21,7 @@ }, "license": "MIT", "scripts": { - "build": "yarn build:server && yarn build:client && yarn build:copy && yarn build:format", - "build:server": "tsc --project tsconfig.server.json", - "build:client": "tsc --project tsconfig.client.json", - "build:copy": "node copyUntypedFiles.mjs", - "build:format": "prettier --config ../../.prettierrc --write \"lib/**/*.js\"" + "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" }, "dependencies": { "@docsearch/react": "^3.0.0", diff --git a/packages/docusaurus-theme-search-algolia/tsconfig.client.json b/packages/docusaurus-theme-search-algolia/tsconfig.client.json index 0ea16454ec40..b391c339cf9a 100644 --- a/packages/docusaurus-theme-search-algolia/tsconfig.client.json +++ b/packages/docusaurus-theme-search-algolia/tsconfig.client.json @@ -1,8 +1,13 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "rootDir": "src", + "outDir": "lib", "module": "esnext", "jsx": "react-native" }, - "include": ["src/theme/", "src/client/", "src/*.d.ts"] + "include": ["src/theme", "src/client", "src/*.d.ts"] } diff --git a/packages/docusaurus-theme-search-algolia/tsconfig.json b/packages/docusaurus-theme-search-algolia/tsconfig.json index 51aec434b257..327ab65c7bbc 100644 --- a/packages/docusaurus-theme-search-algolia/tsconfig.json +++ b/packages/docusaurus-theme-search-algolia/tsconfig.json @@ -1,8 +1,10 @@ { "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { - "lib": ["DOM", "ES2019"], - "rootDir": "src", - "outDir": "lib" + "noEmit": true } } diff --git a/packages/docusaurus-theme-search-algolia/tsconfig.server.json b/packages/docusaurus-theme-search-algolia/tsconfig.server.json index 3faf6c3e997b..516d86b7b8a8 100644 --- a/packages/docusaurus-theme-search-algolia/tsconfig.server.json +++ b/packages/docusaurus-theme-search-algolia/tsconfig.server.json @@ -1,4 +1,12 @@ { - "extends": "./tsconfig.json", - "include": ["src/*.ts", "src/templates/*.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "rootDir": "src", + "outDir": "lib" + }, + "include": ["src"], + "exclude": ["src/client", "src/theme", "**/__tests__/**"] } diff --git a/packages/docusaurus-theme-translations/.npmignore b/packages/docusaurus-theme-translations/.npmignore index 1b59b1ca638c..acffb6122e75 100644 --- a/packages/docusaurus-theme-translations/.npmignore +++ b/packages/docusaurus-theme-translations/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-utils-common/.npmignore b/packages/docusaurus-utils-common/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-utils-common/.npmignore +++ b/packages/docusaurus-utils-common/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-utils-validation/.npmignore b/packages/docusaurus-utils-validation/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-utils-validation/.npmignore +++ b/packages/docusaurus-utils-validation/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-utils/.npmignore b/packages/docusaurus-utils/.npmignore index f2b994d4e359..16beccca2e07 100644 --- a/packages/docusaurus-utils/.npmignore +++ b/packages/docusaurus-utils/.npmignore @@ -1,4 +1,4 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus/.npmignore b/packages/docusaurus/.npmignore index ba8304029eb7..b3d2bb61f7d9 100644 --- a/packages/docusaurus/.npmignore +++ b/packages/docusaurus/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index a2aaee6796a9..1fb6245f9fb1 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -24,8 +24,8 @@ "docusaurus": "bin/docusaurus.mjs" }, "scripts": { - "build": "tsc -p tsconfig.server.json && tsc -p tsconfig.client.json && node copyUntypedFiles.mjs", - "watch": "node copyUntypedFiles.mjs && concurrently -n \"server,client\" --kill-others \"tsc -p tsconfig.server.json --watch\" \"tsc -p tsconfig.client.json --watch\"" + "build": "tsc --build && node copyUntypedFiles.mjs", + "watch": "node copyUntypedFiles.mjs && tsc --watch" }, "bugs": { "url": "https://github.com/facebook/docusaurus/issues" diff --git a/packages/docusaurus/tsconfig.client.json b/packages/docusaurus/tsconfig.client.json index 66613cf7c22d..46b6cfa6cd75 100644 --- a/packages/docusaurus/tsconfig.client.json +++ b/packages/docusaurus/tsconfig.client.json @@ -1,13 +1,13 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "composite": true, "incremental": true, - "lib": ["DOM", "ES2019"], + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", "module": "esnext", - "tsBuildInfoFile": "./lib/client/.tsbuildinfo", - "rootDir": "src/client", - "outDir": "lib/client", - "jsx": "react-native" + "jsx": "react-native", + "rootDir": "src", + "outDir": "lib" }, - "include": ["src/client", "src/deps.d.ts"] + "include": ["src/client", "src/*.d.ts"] } diff --git a/packages/docusaurus/tsconfig.json b/packages/docusaurus/tsconfig.json index e467cc195592..ebbe87890df4 100644 --- a/packages/docusaurus/tsconfig.json +++ b/packages/docusaurus/tsconfig.json @@ -1,10 +1,15 @@ -// For editor typechecking; includes bin { - "extends": "./tsconfig.server.json", + "extends": "../../tsconfig.json", + "references": [ + {"path": "./tsconfig.server.json"}, + {"path": "./tsconfig.client.json"} + ], "compilerOptions": { "noEmit": true, + "allowJs": true, + "checkJs": true, "rootDir": ".", "module": "esnext" }, - "include": ["src", "bin"] + "include": ["bin"] } diff --git a/packages/docusaurus/tsconfig.server.json b/packages/docusaurus/tsconfig.server.json index cabe532baa26..eb1b6945ac88 100644 --- a/packages/docusaurus/tsconfig.server.json +++ b/packages/docusaurus/tsconfig.server.json @@ -1,12 +1,13 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", "rootDir": "src", - "outDir": "lib", - "allowJs": true + "outDir": "lib" }, "include": ["src"], - "exclude": ["**/__tests__/**/*", "src/client"] + "exclude": ["src/client", "**/__tests__/**"] } diff --git a/packages/eslint-plugin/.npmignore b/packages/eslint-plugin/.npmignore index 5f1c98c31f64..3e3043484f2e 100644 --- a/packages/eslint-plugin/.npmignore +++ b/packages/eslint-plugin/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/packages/lqip-loader/.npmignore b/packages/lqip-loader/.npmignore index ba8304029eb7..b3d2bb61f7d9 100644 --- a/packages/lqip-loader/.npmignore +++ b/packages/lqip-loader/.npmignore @@ -1,5 +1,5 @@ copyUntypedFiles.mjs -.tsbuildinfo +.tsbuildinfo* tsconfig* __tests__ diff --git a/tsconfig.json b/tsconfig.json index cb10e8a5ccbc..21cb4421c50a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -44,5 +44,5 @@ "isolatedModules": true, "skipLibCheck": true // @types/webpack and webpack/types.d.ts are not the same thing }, - "exclude": ["node_modules", "**/__tests__/**/*", "**/lib/**/*"] + "exclude": ["node_modules", "**/__tests__/**", "**/lib/**/*"] }