Skip to content

Commit

Permalink
Enable dts-trimming for packages/runtime (microsoft#18359)
Browse files Browse the repository at this point in the history
#### Description

Related:
[18176](https://github.com/microsoft/FluidFramework/pull/18176/files)

This PR adds type-trimming for `packages/runtime` directory. The changes
introduced are:
- Add npm `copyfiles` package as `devDependency`
- Add `dtsRollup` in `api-extractor.json`
- Enable both type-trimming for both `ESM` & `CJS`
- Make `fluidBuild` to fetch dependencies from the scripts included in
`dependsOn`
  • Loading branch information
jikim-msft authored Nov 20, 2023
1 parent 4fd30f5 commit 11df774
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json"
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
}
}
18 changes: 17 additions & 1 deletion packages/runtime/container-runtime-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run",
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
Expand Down Expand Up @@ -45,11 +48,24 @@
"@fluidframework/container-runtime-definitions-previous": "npm:@fluidframework/[email protected]",
"@fluidframework/eslint-config-fluid": "^3.1.0",
"@microsoft/api-extractor": "^7.38.3",
"copyfiles": "^2.4.1",
"eslint": "~8.50.0",
"prettier": "~3.0.3",
"rimraf": "^4.4.0",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/runtime/container-runtime/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json"
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
}
}
18 changes: 17 additions & 1 deletion packages/runtime/container-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
"module": "lib/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:esnext": "tsc --project ./tsconfig.esnext.json",
"build:genver": "gen-version",
"build:test": "tsc --project ./src/test/tsconfig.json",
Expand Down Expand Up @@ -97,6 +100,7 @@
"@types/sinon": "^7.0.13",
"@types/uuid": "^9.0.2",
"c8": "^7.7.1",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "~8.50.0",
"mocha": "^10.2.0",
Expand All @@ -108,6 +112,18 @@
"sinon": "^7.4.2",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {
"ClassDeclaration_ContainerRuntime": {
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime/datastore-definitions/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
},
"messages": {
"extractorMessageReporting": {
"ae-missing-release-tag": {
Expand Down
18 changes: 17 additions & 1 deletion packages/runtime/datastore-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run",
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
Expand Down Expand Up @@ -44,11 +47,24 @@
"@fluidframework/datastore-definitions-previous": "npm:@fluidframework/[email protected]",
"@fluidframework/eslint-config-fluid": "^3.1.0",
"@microsoft/api-extractor": "^7.38.3",
"copyfiles": "^2.4.1",
"eslint": "~8.50.0",
"prettier": "~3.0.3",
"rimraf": "^4.4.0",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/runtime/datastore/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json"
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
}
}
18 changes: 17 additions & 1 deletion packages/runtime/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
"module": "lib/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:esnext": "tsc --project ./tsconfig.esnext.json",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run",
Expand Down Expand Up @@ -87,6 +90,7 @@
"@types/node": "^16.18.38",
"@types/uuid": "^9.0.2",
"c8": "^7.7.1",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "~8.50.0",
"mocha": "^10.2.0",
Expand All @@ -97,6 +101,18 @@
"rimraf": "^4.4.0",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime/runtime-definitions/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
},
"messages": {
"extractorMessageReporting": {
"ae-missing-release-tag": {
Expand Down
18 changes: 17 additions & 1 deletion packages/runtime/runtime-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run",
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
Expand Down Expand Up @@ -44,12 +47,25 @@
"@fluidframework/eslint-config-fluid": "^3.1.0",
"@fluidframework/runtime-definitions-previous": "npm:@fluidframework/[email protected]",
"@microsoft/api-extractor": "^7.38.3",
"copyfiles": "^2.4.1",
"eslint": "~8.50.0",
"eslint-plugin-deprecation": "~2.0.0",
"prettier": "~3.0.3",
"rimraf": "^4.4.0",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {
"TypeAliasDeclaration_IdCreationRangeWithStashedState": {
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime/runtime-utils/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
},
"messages": {
"extractorMessageReporting": {
"ae-missing-release-tag": {
Expand Down
18 changes: 17 additions & 1 deletion packages/runtime/runtime-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
"module": "lib/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:esnext": "tsc --project ./tsconfig.esnext.json",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run",
Expand Down Expand Up @@ -81,6 +84,7 @@
"@types/mocha": "^9.1.1",
"@types/node": "^16.18.38",
"c8": "^7.7.1",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "~8.50.0",
"mocha": "^10.2.0",
Expand All @@ -93,6 +97,18 @@
"ts-node": "^10.9.1",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime/test-runtime-utils/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-base.json",
"dtsRollup": {
"enabled": true
},
"messages": {
"extractorMessageReporting": {
"ae-missing-release-tag": {
Expand Down
18 changes: 17 additions & 1 deletion packages/runtime/test-runtime-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"api": "fluid-build . --task api",
"api-extractor:commonjs": "api-extractor run --local",
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
"build": "fluid-build . --task build",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:docs": "fluid-build . --task api",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run",
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
Expand Down Expand Up @@ -85,6 +88,7 @@
"@types/node": "^16.18.38",
"@types/uuid": "^9.0.2",
"c8": "^7.7.1",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "~8.50.0",
"mocha": "^10.2.0",
Expand All @@ -95,6 +99,18 @@
"rimraf": "^4.4.0",
"typescript": "~5.1.6"
},
"fluidBuild": {
"tasks": {
"build:docs": {
"dependsOn": [
"...",
"api-extractor:commonjs",
"api-extractor:esnext"
],
"script": false
}
}
},
"typeValidation": {
"broken": {}
}
Expand Down
Loading

0 comments on commit 11df774

Please sign in to comment.