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): generate legacy API report #21634

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/common/client-utils/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ nyc
src/test
dist/test
lib/test
lib/client-utils.browser.*.d.ts
lib/client-utils.node.*.d.ts
**/_api-extractor-temp/**
12 changes: 12 additions & 0 deletions packages/common/client-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ file to dist/package.json to set the module type to commonjs. When resolving int
packages, module resolution will walk up from the \*.js file and discover this stub package.json. Because
the stub package.json lacks an export map, internal imports will not be remapped.

## Export Reports and Linting

With the current case of legacy APIs that are present here and the isometric browser and Node.js support,
generation and checking of APIs is unique within client group. `lib/client-utils.(browser|node).*.d.ts` files
are generated but not used in production (excluded from npm package).

For local (development) builds browser reports are generated first and Node.js reports are then verified to
be the same as browser. (Both report sets use the same target files.)

Package scripts `check:exports:esm:indexBrowser:legacy` and `check:exports:esm:indexNode:legacy` are not
verifying actual exports, but the consistency of tags within the legacy API set.

<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->

<!-- prettier-ignore-start -->
Expand Down
4 changes: 0 additions & 4 deletions packages/common/client-utils/api-extractor-lint.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/common/client-utils/api-extractor.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../../../common/build/build-common/api-extractor-base.esm.current.json",
"mainEntryPointFilePath": "<projectFolder>/lib/indexBrowser.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-base.esm.legacy.json",
"mainEntryPointFilePath": "<projectFolder>/lib/<unscopedPackageName>.browser.legacy.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/lib/<unscopedPackageName>.browser.legacy.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/lib/<unscopedPackageName>.node.legacy.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../../../common/build/build-common/api-extractor-base.esm.current.json",
"mainEntryPointFilePath": "<projectFolder>/lib/indexNode.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-base.esm.legacy.json",
"mainEntryPointFilePath": "<projectFolder>/lib/<unscopedPackageName>.node.legacy.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export { EventEmitter }
// @alpha
export type EventEmitterEventType = string;

export { performance_2 as performance }
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an @internal export, right? So this change is effectively a correction of this API-Extractor bug?


// @alpha
export class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
constructor();
Expand Down
58 changes: 55 additions & 3 deletions packages/common/client-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
"default": "./dist/indexBrowser.js"
}
}
},
"./internal-api-report": {
"import": {
"types": {
"browser legacy": "./lib/client-utils.browser.legacy.d.ts",
"node legacy": "./lib/client-utils.node.legacy.d.ts"
}
}
}
},
"main": "lib/indexBrowser.js",
Expand All @@ -42,25 +50,39 @@
"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": "npm run build:docs:browser && npm run build:docs:node",
"build:docs:browser": "npm run build:exports:browser && concurrently \"npm:build:docs:browser:*\"",
"build:docs:browser:current": "api-extractor run --local --config api-extractor/api-extractor-browser.json",
"build:docs:browser:legacy": "api-extractor run --local --config api-extractor/api-extractor-browser.legacy.json",
"build:docs:node": "npm run build:exports:node && concurrently \"npm:build:docs:node:*\"",
"build:docs:node:current": "npm run ci:build:docs:node:current",
"build:docs:node:legacy": "npm run ci:build:docs:node:legacy",
"build:esnext": "tsc --project ./tsconfig.json",
"build:exports:browser": "flub generate entrypoints --outFilePrefix {@unscopedPackageName}.browser. --mainEntrypoint ./src/indexBrowser.ts --outFileAlpha legacy --outDir ./lib",
"build:exports:node": "flub generate entrypoints --outFilePrefix {@unscopedPackageName}.node. --mainEntrypoint ./src/indexNode.ts --outFileAlpha legacy --outDir ./lib",
"build:test": "concurrently npm:build:test:mocha npm:build:test:jest npm:build:test:types",
"build:test:jest": "fluid-tsc commonjs --project ./src/test/jest/tsconfig.cjs.json",
"build:test:mocha": "concurrently npm:build:test:mocha:esm npm:build:test:mocha:cjs",
"build:test:mocha:cjs": "fluid-tsc commonjs --project ./src/test/mocha/tsconfig.cjs.json",
"build:test:mocha:esm": "tsc --project ./src/test/mocha/tsconfig.json",
"build:test:types": "tsc --project ./src/test/types/tsconfig.json",
"check:are-the-types-wrong": "attw --pack .",
"check:are-the-types-wrong": "attw --pack . --exclude-entrypoints internal-api-report",
"check:biome": "biome check . --formatter-enabled=true",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:indexBrowser": "api-extractor run --config api-extractor/api-extractor-lint-indexBrowser.cjs.json",
"check:exports:cjs:indexNode": "api-extractor run --config api-extractor/api-extractor-lint-indexNode.cjs.json",
"check:exports:esm:indexBrowser": "api-extractor run --config api-extractor/api-extractor-lint-indexBrowser.esm.json",
"check:exports:esm:indexBrowser:legacy": "api-extractor run --config api-extractor/api-extractor-lint-indexBrowser.legacy.esm.json",
"check:exports:esm:indexNode": "api-extractor run --config api-extractor/api-extractor-lint-indexNode.esm.json",
"check:exports:esm:indexNode:legacy": "api-extractor run --config api-extractor/api-extractor-lint-indexNode.legacy.esm.json",
"check:format": "npm run check:biome",
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
"ci:build:docs": "api-extractor run",
"ci:build:docs": "concurrently \"npm:ci:build:docs:*\"",
"ci:build:docs:browser:current": "api-extractor run --config api-extractor/api-extractor-browser.json",
"ci:build:docs:browser:legacy": "api-extractor run --config api-extractor/api-extractor-browser.legacy.json",
"ci:build:docs:node:current": "api-extractor run --config api-extractor/api-extractor-node.json",
"ci:build:docs:node:legacy": "api-extractor run --config api-extractor/api-extractor-node.legacy.json",
"clean": "rimraf --glob _api-extractor-temp dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
Expand Down Expand Up @@ -158,6 +180,24 @@
"build:test:jest",
"build:test:types"
],
"build:docs:browser:current": [
"build:exports:browser"
],
"build:docs:browser:legacy": [
"build:exports:browser"
],
"build:docs:node:current": [
"build:docs:browser:current"
],
"build:docs:node:legacy": [
"build:docs:browser:legacy"
],
"check:exports:esm:indexBrowser:legacy": [
"build:exports:browser"
],
"check:exports:esm:indexNode:legacy": [
"build:exports:node"
],
"build:test:jest": [
"tsc"
],
Expand All @@ -169,6 +209,18 @@
],
"build:test:types": [
"build:esnext"
],
"ci:build:docs:browser:current": [
"build:exports:browser"
],
"ci:build:docs:browser:legacy": [
"build:exports:browser"
],
"ci:build:docs:node:current": [
"build:exports:node"
],
"ci:build:docs:node:legacy": [
"build:exports:node"
]
}
},
Expand Down
Loading