Skip to content

Use pruned DTS file for API report #4207

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

Merged
merged 26 commits into from
Feb 16, 2021
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Dec 14, 2020

This PR hooks the "prune-dts" script into Firestor's API Extractor pipeline. It runs three phases:

  • Use API Extractor to generate a rollup DTS
  • Prune the rollup DTS to strip private symbols
  • Use API Extractor to generate the API report based on the pruned symbols

As you can see in the output, this removes all sort of weird private types from the API report.

Also changed the .eslint.json in prune-dts to be more efficient by not including all .ts files in the entire repo.

Fixes #4441

@changeset-bot
Copy link

changeset-bot bot commented Dec 14, 2020

⚠️ No Changeset found

Latest commit: c006e4b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 14, 2020

Size Analysis Report

Affected Products

No changes between base commit (9ac2093) and head commit (7407901).

@schmidt-sebastian
Copy link
Contributor Author

@Feiyang1 I was wondering if you had an opinion here. Should we carry this forward?

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 10, 2021

Binary Size Report

Affected SDKs

No changes between base commit (9ac2093) and head commit (7407901).

Test Logs

@@ -79,7 +78,8 @@
"@firebase/app-types": "0.x"
},
"devDependencies": {
"@firebase/app": "0.6.14",
"@firebase/app": "0.6.13",
Copy link
Contributor

Choose a reason for hiding this comment

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

bump back up to 14

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think this was causing all the build failures earlier.

@@ -27,9 +25,9 @@
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"prettier": "prettier --write '*.js' '*.ts' '@(lite|exp|src|test)/**/*.ts'",
"pregendeps:exp": "yarn api-report:exp && node scripts/build-bundle.js --input ./exp/index.ts --output ./dist/exp/tmp.js",
"pregendeps:exp": "yarn api-report&& node scripts/build-bundle.js --input ./exp/index.ts --output ./dist/exp/tmp.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

Space before && (don't think it NEEDS it but for formatting)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@schmidt-sebastian
Copy link
Contributor Author

Added bug fix to Prune DTS so that it no longer replaces PromiseLike with LoadBundleTask.

Copy link
Contributor

@hsubox76 hsubox76 left a comment

Choose a reason for hiding this comment

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

LGTM, I don't know if @Feiyang1 wants to take a second glance at the api-report script.

@@ -46,7 +44,8 @@
"test:node:persistence:prod": "node ./scripts/run-tests.js --main=index.node.ts --persistence 'test/{,!(browser|lite)/**/}*.test.ts'",
"test:travis": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/firestore-test-runner.ts",
"test:minified": "(cd ../../integration/firestore ; yarn test)",
"api-report": "rm -rf temp && api-extractor run --local --verbose",
"prepare": "yarn build:release",
"api-report": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ./scripts/api-report.js",
Copy link
Member

Choose a reason for hiding this comment

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

Should we execute api-report.ts directly since we are using ts-node. Then we won't need to commit the compiled js.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The compiled JS gets committed because of the yarn build:scripts rule which is needed because of rollup. I fixed this line though since using ts-node and the .js script is pretty... awkward.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

Addressed feedback. Thanks for making most of it clickable :)

@@ -46,7 +44,8 @@
"test:node:persistence:prod": "node ./scripts/run-tests.js --main=index.node.ts --persistence 'test/{,!(browser|lite)/**/}*.test.ts'",
"test:travis": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/firestore-test-runner.ts",
"test:minified": "(cd ../../integration/firestore ; yarn test)",
"api-report": "rm -rf temp && api-extractor run --local --verbose",
"prepare": "yarn build:release",
"api-report": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ./scripts/api-report.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The compiled JS gets committed because of the yarn build:scripts rule which is needed because of rollup. I fixed this line though since using ts-node and the .js script is pretty... awkward.

@schmidt-sebastian schmidt-sebastian merged commit 536b47e into master Feb 16, 2021
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/apiextractor branch February 16, 2021 21:37
@firebase firebase locked and limited conversation to collaborators Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

alpha: Type 'LoadBundleTask' is not generic
4 participants