Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(client): Use new node16 tsconfigs in azure, client, and DDS projects #18152

Merged
Merged
17 changes: 9 additions & 8 deletions azure/packages/azure-client/src/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "../../dist/test",
"composite": true,
"types": ["mocha", "node"],
"skipLibCheck": true,
},
"extends": [
"../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"references": [
{
"path": "../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../dist/test",
"types": ["mocha", "node"],
},
}
3 changes: 1 addition & 2 deletions azure/packages/azure-client/tsconfig.esnext.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"extends": ["./tsconfig.json", "../../../common/build/build-common/tsconfig.esm.json"],
"compilerOptions": {
"outDir": "./lib",
"module": "esnext",
},
}
11 changes: 6 additions & 5 deletions azure/packages/azure-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"extends": [
"../../../common/build/build-common/tsconfig.base.json",
"../../../common/build/build-common/tsconfig.cjs.json",
],
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"composite": true,
"types": ["node"],
},
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
}
10 changes: 6 additions & 4 deletions azure/packages/azure-local-service/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"exclude": [],
"extends": [
"../../../common/build/build-common/tsconfig.base.json",
"../../../common/build/build-common/tsconfig.cjs.json",
],
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"composite": true,
},
"include": ["src/**/*"],
}
19 changes: 10 additions & 9 deletions azure/packages/azure-service-utils/src/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "../../dist/test",
"declaration": false,
"declarationMap": false,
"skipLibCheck": true,
"noEmit": true,
},
"extends": [
"../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"references": [
{
"path": "../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../dist/test",
"noEmit": true,
"types": [],
},
}
3 changes: 1 addition & 2 deletions azure/packages/azure-service-utils/tsconfig.esnext.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"extends": ["./tsconfig.json", "../../../common/build/build-common/tsconfig.esm.json"],
"compilerOptions": {
"outDir": "./lib",
"module": "esnext",
},
}
9 changes: 5 additions & 4 deletions azure/packages/azure-service-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"extends": [
"../../../common/build/build-common/tsconfig.base.json",
"../../../common/build/build-common/tsconfig.cjs.json",
],
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
"compilerOptions": {
"strictNullChecks": true,
"rootDir": "./src",
"outDir": "./dist",
"composite": true,
},
"include": ["src/**/*"],
}
21 changes: 21 additions & 0 deletions common/build/build-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,24 @@ It can be extended in your package's local configuration file like the following

This package previously exported a series of configurations with differing levels of validation.
These configurations are now deprecated and have been replaced with the configuration noted above.

## TypeScript Configurations (`tsconfig.json`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding these docs! These are great!


This package includes several TypeScript config (tsconfig) files that are contain the common configurations used within
the Fluid Framework repo. These configs are designed to be used together using [TypeScript's support for extending
multiple config
files](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#supporting-multiple-configuration-files-in-extends).

- tsconfig.base.json - This base config contains defaults that all packages within the repo should use as a baseline.
- tsconfig.cjs.json - This config sets `module: Node16` and is intended for CommonJS builds. This config is intended to
be layered on top of the base config.
- tsconfig.esm.json - This config sets `module: ESNext` and `moduleResolution: Node10` and is intended for ESM builds. This config
intended to be layered on top of the base config. This config uses Node10 module resolution because Node16 cannot be
used to build both CJS and ESM from a common source.
- tsconfig.test.json - This config disables some settings that we don't want to use in test code, like `declaration` and
`decarationMap`. It also enables the `node` types by default.

### Legacy tsconfig

This package also contains a legacy base tsconfig, `ts-common-config.json`. This config is still used in some places
within the repo but is considered deprecated.
1 change: 1 addition & 0 deletions common/build/build-common/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"esModuleInterop": true,
"incremental": true,
"inlineSources": true,
"jsx": "react",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"noImplicitAny": false,
"noUnusedLocals": true,
Expand Down
1 change: 0 additions & 1 deletion common/build/build-common/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": ["./tsconfig.base.json"],
"compilerOptions": {
"module": "Node16",
},
Expand Down
1 change: 0 additions & 1 deletion common/build/build-common/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": ["./tsconfig.base.json"],
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node10",
Expand Down
3 changes: 2 additions & 1 deletion common/build/build-common/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": ["./tsconfig.esm.json"],
"extends": ["./tsconfig.base.json", "./tsconfig.esm.json"],
"compilerOptions": {
"composite": false,
"types": ["node"],
"declaration": false,
"declarationMap": false,
"skipLibCheck": true,
"module": "CommonJS",
},
}
2 changes: 1 addition & 1 deletion packages/common/client-utils/src/hashFileBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function hashFile(
if (crypto.subtle === undefined) {
return import(
/* webpackChunkName: "FluidFramework-HashFallback" */
"./hashFileNode"
"./hashFileNode.js"
).then(async (m) => m.hashFile(file, algorithm, hashEncoding));
}

Expand Down
15 changes: 9 additions & 6 deletions packages/common/client-utils/src/test/jest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/jest",
"types": ["jest", "jest-environment-puppeteer", "node", "puppeteer"],
},
"extends": [
"../../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"references": [
{
"path": "../../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/jest",
"types": ["jest", "jest-environment-puppeteer", "node", "puppeteer"],
},
}
16 changes: 9 additions & 7 deletions packages/common/client-utils/src/test/mocha/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"exclude": ["dist", "node_modules"],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/mocha",
"types": ["node", "mocha"],
},
"extends": [
"../../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"references": [
{
"path": "../../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/mocha",
"types": ["mocha", "node"],
},
}
28 changes: 15 additions & 13 deletions packages/common/client-utils/src/test/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"extends": [
Josmithr marked this conversation as resolved.
Show resolved Hide resolved
"../../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"exclude": [
"dist",
"node_modules"
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/types",
},
"include": [
"./**/*"
],
"references": [
{
"path": "../../.."
}
]
"references": [
{
"path": "../../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/types",
"types": [],
},
}
3 changes: 1 addition & 2 deletions packages/common/client-utils/tsconfig.esnext.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"extends": ["./tsconfig.json", "../../../common/build/build-common/tsconfig.esm.json"],
"compilerOptions": {
"outDir": "./lib",
"module": "esnext",
},
}
10 changes: 6 additions & 4 deletions packages/common/client-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"extends": [
"../../../common/build/build-common/tsconfig.base.json",
"../../../common/build/build-common/tsconfig.cjs.json",
],
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"composite": true,
"baseUrl": ".",
"paths": {
"perf_hooks": ["types/perf_hooks.d.ts"],
},
"types": ["events"],
},
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
}
33 changes: 16 additions & 17 deletions packages/common/container-definitions/src/test/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/types",
"declaration": false,
"declarationMap": false,
"skipLibCheck": true,
"noEmit": true,
},
"include": [
"./**/*"
],
"references": [
{
"path": "../../.."
}
]
"extends": [
"../../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"references": [
{
"path": "../../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../../dist/test/types",
"noEmit": true,
"types": [],
},
}
3 changes: 1 addition & 2 deletions packages/common/container-definitions/tsconfig.esnext.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"extends": ["./tsconfig.json", "../../../common/build/build-common/tsconfig.esm.json"],
"compilerOptions": {
"outDir": "./lib",
"module": "esnext",
},
}
8 changes: 5 additions & 3 deletions packages/common/container-definitions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"extends": [
"../../../common/build/build-common/tsconfig.base.json",
"../../../common/build/build-common/tsconfig.cjs.json",
],
"include": ["src/**/*"],
"exclude": ["src/test/**/*"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"composite": true,
},
"include": ["src/**/*"],
}
17 changes: 8 additions & 9 deletions packages/common/core-interfaces/src/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"extends": "@fluidframework/build-common/ts-common-config.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "../../dist/test",
"declaration": false,
"declarationMap": false,
"skipLibCheck": true,
"noEmit": true,
},
"extends": [
"../../../../../common/build/build-common/tsconfig.base.json",
"../../../../../common/build/build-common/tsconfig.test.json",
],
"include": ["./**/*"],
"references": [
{
"path": "../..",
},
],
"compilerOptions": {
"rootDir": "./",
"outDir": "../../dist/test",
},
}
Loading