-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…528) ## Summary: I ran into a number of issues with dts-bundle-generator. It exports private that weren't exported and it can't handle having multiple types with the same name, e.g. different 'Options' types are defined in multiple places in wonder-stuff-server. This PR address the issue by using project references which allow us to have multiple tsconfig.json files (one for each package) in a single repo. Each tsconfig.json defines where the root (source) and output directories are relative to the tsconfig.json file. The root tsconfig.json doesn't cover any source files and instead only references the other tsconfig.json in the package folders. https://www.typescriptlang.org/docs/handbook/project-references.html#composite Issue: FEI-4957 TODO: - [x] update the existing build scripts to not generate a .d.ts file or .flow.js - [x] update CI to run build:types ## Test plan: - remove the `@ts-expect-error` comment from isolate-modules.ts, see that there's an error reported in VSCode - `yarn clean` - `yarn build:types`, see the same error reported - `yarn typecheck`, see the same error - re-add the the `@ts-expect-error` comment, see the error is gone in VSCode - re-run the `yarn` commands from above, see that the error is no longer reported by them Author: kevinbarabash Reviewers: jeresig, kevinbarabash Required Reviewers: Approved By: jeresig, jeresig Checks: ✅ CodeQL, ⌛ Lint, typecheck, and coverage check (ubuntu-latest, 16.x), ⏭ dependabot, ✅ gerald, ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 16.x), ✅ Analyze (javascript) Pull Request URL: #528
- Loading branch information
1 parent
f37b289
commit da34455
Showing
21 changed files
with
172 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ws-dev-build-settings": patch | ||
--- | ||
|
||
Don't generate index.js.flow and index.d.ts files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ flow-coverage | |
dist | ||
!.vscode | ||
.DS_Store | ||
yarn-error.log | ||
yarn-error.log | ||
tsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This file is used by the tsconfig.json files in each package. | ||
/* Visit https://aka.ms/tsconfig to read more about this file */ | ||
{ | ||
"extends": "../tsconfig-common.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"incremental": true, // Required for composite projects | ||
|
||
// We use rollup + babel to compile our bundles so we | ||
// only need tsc to output .d.ts files | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
|
||
"paths": { | ||
"@khanacademy/*": [ | ||
"./*/src" | ||
] | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"exclude": ["dist", "**/*.flowtest.ts"], | ||
"extends": "../tsconfig-shared.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"exclude": ["dist", "**/*.flowtest.ts"], | ||
"extends": "../tsconfig-shared.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"exclude": ["dist", "**/*.flowtest.ts"], | ||
"extends": "../tsconfig-shared.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
}, | ||
"references": [ | ||
{"path": "../wonder-stuff-core"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"exclude": ["dist", "**/*.flowtest.ts"], | ||
"extends": "../tsconfig-shared.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
}, | ||
"references": [ | ||
{"path": "../wonder-stuff-core"}, | ||
{"path": "../wonder-stuff-server"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"exclude": ["dist", "**/*.flowtest.ts"], | ||
"extends": "../tsconfig-shared.json", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"rootDir": "src", | ||
}, | ||
"references": [ | ||
{"path": "../wonder-stuff-core"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"exclude": ["dist", "**/*.flowtest.ts"], | ||
"extends": "../tsconfig-shared.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
}, | ||
"references": [ | ||
{"path": "../wonder-stuff-core"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This file is used by the `build:types` command in package.json | ||
/* Visit https://aka.ms/tsconfig to read more about this file */ | ||
{ | ||
// Intentionally empty, all files are covered by tsconfig.json files | ||
// in each package directory. | ||
"files": [], | ||
"references": [ | ||
{"path": "./packages/wonder-stuff-core"}, | ||
{"path": "./packages/wonder-stuff-i18n"}, | ||
{"path": "./packages/wonder-stuff-sentry"}, | ||
{"path": "./packages/wonder-stuff-server"}, | ||
{"path": "./packages/wonder-stuff-server-google"}, | ||
{"path": "./packages/wonder-stuff-testing"}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This file is used by the `typecheck` command in package.json | ||
/* Visit https://aka.ms/tsconfig to read more about this file */ | ||
{ | ||
"exclude": ["**/dist", "**/*.flowtest.ts"], | ||
"extends": "./tsconfig-common.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
|
||
"paths": { | ||
"@khanacademy/*": ["./packages/*/src"] | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// This file contains common compiler options that are used by all tsconfigs | ||
/* Visit https://aka.ms/tsconfig to read more about this file */ | ||
{ | ||
"compilerOptions": { | ||
/* Language and Environment */ | ||
"target": "ES2016", | ||
|
||
/* Modules */ | ||
// Required for dynamic imports even though we aren't using | ||
// tsc to output any modules. | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
|
||
/* Interop Constraints */ | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
|
||
/* Type Checking */ | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"strictPropertyInitialization": true, | ||
"strictBindCallApply": true, | ||
"noImplicitAny": true, | ||
|
||
/* Completeness */ | ||
"skipDefaultLibCheck": true, // it's safe to assume that built-in .d.ts files are correct | ||
"skipLibCheck": false | ||
} | ||
} |
Oops, something went wrong.