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

Fixes to support Generating API Documentation #4391

Merged
merged 6 commits into from
Oct 27, 2023

Conversation

audionerd
Copy link
Contributor

@audionerd audionerd commented Oct 24, 2023

Companion PR for statelyai/docs#237, which now uses xstate as a submodule, and requires these changes in order to build API docs.

This PR fixes issues that prevented the XState API docs index page from rendering properly, and fixes two warnings that occurred when API Documenter ran.

Includes and closes #4374

this fixes an error when generating API documentation which prevents an documentation index page from being created
@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2023

⚠️ No Changeset found

Latest commit: c9e9b6e

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 24, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c9e9b6e:

Sandbox Source
XState Example Template Configuration
XState React Template Configuration

@@ -284,6 +287,8 @@ export interface StateValueMap {
/**
* The string or object representing the state value relative to the parent state node.
*
* @remarks
Copy link
Member

Choose a reason for hiding this comment

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

I'm still quite unsure why we need this. RxJS has extensive and long JSDocs and they use api-extractor too but there is no @remarks in sight in their codebase. I wonder what's the difference? 🤔

Copy link
Contributor Author

@audionerd audionerd Oct 25, 2023

Choose a reason for hiding this comment

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

On the index page a description is provided for each item.

With @remarks, we can choose to show only the first summary line in the descriptions:
index-with-remarks

Without @remarks, the description is longer (and most of the index descriptions are a single line so this one stands out):
index-without-remarks

So it’s a subjective change, but I thought it was better to have a shorter description. If you disagree I’m happy to change it back.

I had also noticed the list items weren’t formatted properly on the index, so I wanted to omit them, but I just found a fix for that I can push to this PR, so it's not a deciding factor.

Copy link
Contributor Author

@audionerd audionerd Oct 25, 2023

Choose a reason for hiding this comment

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

According to the API Extractor docs, it expects TSDoc and @remarks is specific to TSDoc, which explains why you wouldn’t see it in JSDocs. See: https://tsdoc.org/pages/tags/remarks

I’m curious about how RxJS docs are set up though. I’ll take a look.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, OK - so actually RxJS is not using the api-extractor (my memory is failing me). I agree that a shorter summary in this table is better but I really wish that we wouldn't have to use @remarks for this. Despite TSDoc being a Microsoft project, VS Code doesn't handle those TSDoc tags nicely 🤷‍♂️

I'm fine either way though - we can always revisit this in the future. I just feel that the primary use case for those JSDoc comments is the in-IDE experience and the API docs page generation comes second. We have some level of control over how API docs end up being generated as we can script whatever we want - we have 0 control over how an IDE renders its tooltips (beyond what we can configure using the JSDoC tags that it knows and understands)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. I’ll see what I can find out about TSDocs in VS Code. Might be some ways to improve the experience.

@@ -835,7 +841,7 @@ export interface StateNodeConfig<
TDelay
>;
/**
* @private
* @internal
Copy link
Member

Choose a reason for hiding this comment

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

We are using stripInternal and I'm not sure if we want to "hide" this parent property like this. I'd remove this particular comment completely.

@davidkpiano davidkpiano merged commit e676dff into statelyai:next Oct 27, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants