Skip to content

Commit

Permalink
refactor: use TS project references instead of running tsc multiple t…
Browse files Browse the repository at this point in the history
…imes
  • Loading branch information
Josh-Cena committed May 17, 2022
1 parent 1bec5f6 commit 0b2af61
Show file tree
Hide file tree
Showing 67 changed files with 276 additions and 124 deletions.
2 changes: 1 addition & 1 deletion packages/create-docusaurus/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
__tests__
node_modules

Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-logger/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-mdx-loader/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-migrate/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__

Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-client-redirects/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-blog/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-docs/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"types": "src/plugin-content-docs.d.ts",
"scripts": {
"build": "tsc",
"build": "tsc --build",
"watch": "tsc --watch"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

/// <reference types="@docusaurus/module-type-aliases" />

declare module '@docusaurus/plugin-content-docs' {
import type {MDXOptions} from '@docusaurus/mdx-loader';
import type {
Expand Down
2 changes: 0 additions & 2 deletions packages/docusaurus-plugin-content-docs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/// <reference types="@docusaurus/module-type-aliases" />

import type {BrokenMarkdownLink, Tag} from '@docusaurus/utils';
import type {
VersionMetadata,
Expand Down
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-content-docs/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 5 additions & 4 deletions packages/docusaurus-plugin-content-docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-content-docs/tsconfig.server.json
Original file line number Diff line number Diff line change
@@ -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__/**"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-pages/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-debug/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-debug/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 5 additions & 4 deletions packages/docusaurus-plugin-debug/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-debug/tsconfig.server.json
Original file line number Diff line number Diff line change
@@ -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"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-analytics/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"access": "public"
},
"scripts": {
"build": "tsc",
"build": "tsc --build",
"watch": "tsc --watch"
},
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-google-analytics/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 5 additions & 4 deletions packages/docusaurus-plugin-google-analytics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-google-analytics/tsconfig.server.json
Original file line number Diff line number Diff line change
@@ -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"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-gtag/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-gtag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc",
"build": "tsc --build",
"watch": "tsc --watch"
},
"publishConfig": {
Expand Down
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-google-gtag/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 5 additions & 4 deletions packages/docusaurus-plugin-google-gtag/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-google-gtag/tsconfig.server.json
Original file line number Diff line number Diff line change
@@ -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"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-ideal-image/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
6 changes: 1 addition & 5 deletions packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 0 additions & 8 deletions packages/docusaurus-plugin-ideal-image/tsconfig.browser.json

This file was deleted.

13 changes: 13 additions & 0 deletions packages/docusaurus-plugin-ideal-image/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -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"]
}
8 changes: 5 additions & 3 deletions packages/docusaurus-plugin-ideal-image/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
13 changes: 11 additions & 2 deletions packages/docusaurus-plugin-ideal-image/tsconfig.server.json
Original file line number Diff line number Diff line change
@@ -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"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-pwa/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
copyUntypedFiles.mjs
.tsbuildinfo
.tsbuildinfo*
tsconfig*
__tests__
5 changes: 1 addition & 4 deletions packages/docusaurus-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
},
Expand Down
Loading

0 comments on commit 0b2af61

Please sign in to comment.