Skip to content

docs: add API extractor #354

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 7 commits into from
Oct 18, 2021
Merged

docs: add API extractor #354

merged 7 commits into from
Oct 18, 2021

Conversation

grant
Copy link
Contributor

@grant grant commented Oct 15, 2021

Add setup for creating API docs for the Node Functions Framework. Does not attempt to annotate whole library (but just enough to make the generator not err).

Fixes #349

Generated API docs: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/grant_api_extractor/docs/api.md


Note: There aren't that many types right now because we removed a large chunk of the exported API: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/pull/347/files#r724614498

I'm not sure though.

I think we're trying to add that back before releasing a new version of this framework.

Signed-off-by: Grant Timmerman <[email protected]>
@grant grant self-assigned this Oct 15, 2021
@google-cla google-cla bot added the cla: yes label Oct 15, 2021
Signed-off-by: Grant Timmerman <[email protected]>
@grant grant requested a review from anniefu October 15, 2021 22:29
@matthewrobertson
Copy link
Member

There aren't that many types right now because we removed a large chunk of the exported API

Something is fishy here, but I don't think we removed the exported API. I see some issues that suggest api-extractor has trouble with re-export statements: microsoft/rushstack#663

Maybe we need to just update this line in src/index.ts

Copy link
Member

@matthewrobertson matthewrobertson left a comment

Choose a reason for hiding this comment

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

@grant I investigated a bit I think you were having problems because you were adding comments to things we were re-exporting in index.ts. I think when you do that it clobbers any annotations in the underlying file.

Copy link
Contributor Author

@grant grant left a comment

Choose a reason for hiding this comment

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

Thanks @matthewrobertson @anniefu, I updated the generated docs. They should be a bit more comprehensive now too :) PTAL


"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "docs/generated/api.d.ts",
Copy link
Member

Choose a reason for hiding this comment

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

I think we eventually want to actually make this the types we use in our package.json file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that's fine. There would need to be some script or tooling to update this generated file with package.json types.

Or we could simply not generate this file.

Copy link
Member

@matthewrobertson matthewrobertson left a comment

Choose a reason for hiding this comment

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

LGTM. Please fix the warning before landing.

As a next step it would be good to add an action to automatically validate or generate these when a PR gets submitted.

Signed-off-by: Grant Timmerman <[email protected]>
@grant grant merged commit a8e9c9a into master Oct 18, 2021
@grant grant deleted the grant_api_extractor branch October 18, 2021 23:45
@grant grant mentioned this pull request Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add api-extractor
3 participants