Skip to content

Commit

Permalink
build(client): use fluid-tsc for Node16 test builds (microsoft#19726)
Browse files Browse the repository at this point in the history
build(client): use fluid-tsc for Node16 test builds
- remove now stale tsc-multi configurations and replace all use with
fluid-tsc.
- enable ESM build for tree test
- Make ajvValidator CommonJS to accommodate typescript's rejection of
Ajv's handcrafted ES Module support.
- *However*, ESM test build is not runnable per internal module import
of id-compressor CommonJS output
(`@fluidframework/id-compressor/dist/test`).
- correct @fluid-private/test-end-to-end-tests build dependencies (was
changed to ESNext in microsoft#15976) and @fluidframework/container-runtime test
support was previously moved to production (in microsoft#18826).
- update build-tools

Updated the following:

  client (release group)
  client-release-group-root

Dependencies on build-tools updated:

  @fluid-tools/build-cli: 0.34.0
  @fluidframework/build-tools: 0.34.0
  @fluidframework/bundle-size-tools: 0.34.0
  @fluid-tools/version-tools: 0.34.0

Command used:

```shell
pnpm flub bump deps build-tools -g client -t latest --updateChecker homegrown -x
```
  • Loading branch information
jason-ha committed Feb 21, 2024
1 parent e0205c0 commit e264012
Show file tree
Hide file tree
Showing 174 changed files with 941 additions and 900 deletions.
2 changes: 1 addition & 1 deletion azure/packages/azure-local-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"devDependencies": {
"@arethetypeswrong/cli": "^0.13.3",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@microsoft/api-extractor": "^7.39.1",
"eslint": "~8.50.0",
Expand Down
4 changes: 2 additions & 2 deletions azure/packages/azure-service-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.13.3",
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/azure-service-utils-previous": "npm:@fluidframework/azure-service-utils@2.0.0-internal.8.0.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@microsoft/api-extractor": "^7.39.1",
"@types/jsrsasign": "^10.5.12",
Expand Down
2 changes: 1 addition & 1 deletion azure/packages/test/end-to-end-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
},
"devDependencies": {
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@types/mocha": "^9.1.1",
"@types/nock": "^9.3.0",
Expand Down
4 changes: 2 additions & 2 deletions azure/packages/test/scenario-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@types/js-yaml": "^4.0.5",
"@types/mocha": "^9.1.1",
Expand Down
59 changes: 47 additions & 12 deletions common/build/build-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,51 @@ files](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0
- tsconfig.test.node16.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.

### Dual Build Pattern

Proper ESM build with full validation via Typescript compiler requires Node16 or NodeNext module and `"type": "module"` in package.json. To get a same package CommonJS build, a second tsconfig file should be create with a different `outDir` and `fluid-tsc` should be used for the build in place of `tsc`. Example:

```shell
fluid-tsc commonjs --project ./tsconfig.cjs.json
```

Then an additional `package.json` should be injected into the `outDir` so that references understand those `.js` files are CommonJs. `common/build/build-common/src/cjs/package.json` can be copied for this purpose. Example:

```shell
copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist
```

#### Recommended Secondary Project Files

tsconfig.cjs.json:

```json
{
// This config must be used in a "type": "commonjs" environment. (Use `fluid-tsc commonjs`.)
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
}
}
```

src/test/tsconfig.cjs.json:

```json
{
// This config must be used in a "type": "commonjs" environment. (Use `fluid-tsc commonjs`.)
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/test"
},
"references": [
{
"path": "../../tsconfig.cjs.json"
}
]
}
```

### Legacy tsconfig

This package also contains a legacy base tsconfig, `ts-common-config.json`. This config is still used in some places
Expand All @@ -51,16 +96,6 @@ within the repo but is considered deprecated.
And there are a handful of tsconfigs that we thought we'd want but no longer think they have common purpose:
`tsconfig.cjs.json`, `tsconfig.esm.json`, `tsconfig.esm-only.json`, and `tsconfig.test.json`

## Tsc-Multi Configurations (`tsc-multi.*.json`)

This package includes several Tsc-Multi config files that are contain the common configurations used within
the Fluid Framework repo. These configs are designed to be used to dual build packages for CommonJS and ESM.

- tsc-multi.type-commonjs.json - basic specification that overrides tsc view of current directory package.json "type" to be "commonjs". To be used in conjunction with a tsc project file, which specifies `"module": "Nodes16"`, on command line.
- tsc-multi.type-module.json - basic specification that overrides tsc view of current directory package.json "type" to be "module". To be used in conjunction with a tsc project file, which specifies `"module": "Nodes16"`, on command line.
- tsc-multi.node16.cjs.json - complete specification with package `"type": "commonjs"` override, tsc `"outDir": "dist"` override, and reference to `tsconfig.json` project, which is expected to specify `"module": "Nodes16"`. If also testing both CommonJs and ESM, prefer using `tsc-multi.type-commonjs.json` and a local tsconfig.cjs.json with `outDir` override for both product and test builds. (The test tsconfig.cjs.json will need `references` to the product tsconfig.cjs.json.)

### Legacy tsc-multi.\*.json
## Deprecated Tsc-Multi Configurations (`tsc-multi.*.json`)

Several Tsc-Multi config files remain that use a deprecated style of dual build that emit modified .js extensions. As extension modification means rewriting files the likelihood of error is signficant and this has been superceded by package type override pattern. Configurations that should be replaced:
`tsc-multi.cjs.json`, `tsc-multi.esm.json`
Several Tsc-Multi config files remain that use a deprecated style of dual build that emit modified .js extensions. As extension modification means rewriting files the likelihood of error is signficant and this has been superceded by package type override pattern. All uses of `tsc-multi` should be removed/replaced.
4 changes: 0 additions & 4 deletions common/build/build-common/tsc-multi.node16.cjs.json

This file was deleted.

3 changes: 0 additions & 3 deletions common/build/build-common/tsc-multi.type-commonjs.json

This file was deleted.

3 changes: 0 additions & 3 deletions common/build/build-common/tsc-multi.type-module.json

This file was deleted.

4 changes: 2 additions & 2 deletions examples/apps/attributable-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@fluidframework/runtime-utils": "workspace:~"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/collaborative-textarea/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"style-loader": "^1.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@fluidframework/test-utils": "workspace:~",
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/contact-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/data-object-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/presence-tracker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"process": "^0.11.10"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/task-selection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"style-loader": "^1.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/tree-comparison/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/bubblebench/baseline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/benchmarks/bubblebench/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
"use-resize-observer": "^7.0.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/mocha-test-setup": "workspace:~",
"@types/mocha": "^9.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/bubblebench/ot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/bubblebench/sharedtree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"webpack-dev-server": "~4.6.0"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@types/express": "^4.11.0",
"@types/fs-extra": "^9.0.11",
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/tablebench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"devDependencies": {
"@fluid-tools/benchmark": "^0.48.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/id-compressor": "workspace:~",
"@fluidframework/mocha-test-setup": "workspace:~",
Expand Down
2 changes: 1 addition & 1 deletion examples/client-logger/app-insights-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"devDependencies": {
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@testing-library/dom": "^8.2.0",
"@testing-library/jest-dom": "^5.16.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/clicker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@fluidframework/test-utils": "workspace:~",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/codemirror/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@types/codemirror": "5.60.7",
"@types/node": "^18.19.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/diceroller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/inventory-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@types/react": "^17.0.44",
"css-loader": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/data-objects/multiview/container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/data-objects/multiview/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"webpack:dev": "webpack --env development"
},
"devDependencies": {
"@fluid-tools/build-cli": "^0.33.0",
"@fluid-tools/build-cli": "^0.34.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@types/node": "^18.19.0",
"@types/react": "^17.0.44",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"devDependencies": {
"@fluid-example/webpack-fluid-loader": "workspace:~",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.33.0",
"@fluidframework/build-tools": "^0.34.0",
"@fluidframework/eslint-config-fluid": "^3.5.0",
"@fluidframework/test-tools": "^1.0.195075",
"@types/jest": "29.5.3",
Expand Down
Loading

0 comments on commit e264012

Please sign in to comment.