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

feat: implement typedoc in vitepress #1115

Merged
merged 20 commits into from
Jul 25, 2023
Merged

Conversation

danielbate
Copy link
Contributor

@danielbate danielbate commented Jul 21, 2023

Following discussions in #835, this reimplements typedoc to provide API documentation to be housed by our current vitepress implementation by:

  • Installing typedoc along with the modular and markdown plugins and adding to vitepress config
  • Implementing typedoc config in the Address and Interface packages
  • Add typedoc syntax to classes we want to hide/show
  • Improve docs on classes/methods
  • Generate API docs
Screenshot 2023-07-21 at 14 04 07

This is a proof of concept hence having only implemented it in 2 packages. Should we be happy with the implementation, we can extend this by autogenerating the vitepress links (the plugin that does is out of date with the latest version of typedoc but is not difficult to implement). There is also room for improvement of our usage of typedoc syntax inside these classes.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
83.55% (-1.28% 🔻)
4261/5100
🟡 Branches
62.71% (-0.07% 🔻)
624/995
🟡 Functions
72.84% (+3.78% 🔼)
724/994
🟢 Lines
83.68% (-1.3% 🔻)
4077/4872

Test suite run success

1049 tests passing in 181 suites.

Report generated by 🧪jest coverage report action from 7402047

@danielbate danielbate marked this pull request as ready for review July 21, 2023 13:35
Copy link
Member

@arboleya arboleya left a comment

Choose a reason for hiding this comment

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

Looking beautiful.

I didn't review yet, just quickly glanced over it, here are some preliminary comments:

  1. Should we commit the generated MD files inside src/api/classes? Perhaps these could be generated only in CI before publishing. What do you think?
  2. There seem to be a couple of annotations like this:

annotation

@danielbate danielbate self-assigned this Jul 21, 2023
@danielbate danielbate added the docs Requests pertinent to documentation label Jul 21, 2023
Copy link
Member

@arboleya arboleya left a comment

Choose a reason for hiding this comment

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

  1. Should we commit the generated MD files inside src/api/classes?

Another indication this may be optimal is that these files contain dynamic links such as:

Due to the blog part (bef034a9), files will appear modified even when unchanged.

Other than that, everything is looking good! Very clean. 👌

camsjams
camsjams previously approved these changes Jul 24, 2023
Copy link
Contributor

@camsjams camsjams left a comment

Choose a reason for hiding this comment

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

Looks good at the surface level. How does this get updated (similar to what @arboleya mentioned)

Last time we used typedoc it updated alongside the changeset code, but with vitepress I think we can forego any git records right?

apps/docs/.typedoc/api-readme.md Show resolved Hide resolved
@arboleya
Copy link
Member

arboleya commented Jul 24, 2023

@danielbate Because you're already integrated typedoc in the existent docs build routine:

"build": "typedoc && vitepress build",

You just need to ignore these two dirs and voilà:

  • src/api/classes
  • src/api/modules

Everything else is already taken care of.

@Torres-ssf can correct me if I'm missing something.

@danielbate
Copy link
Contributor Author

danielbate commented Jul 24, 2023

@camsjams @arboleya will get the built docs files removed. Only risk is including classes/methods in the docs that were intended to be hidden/internal only, as they won't be included in the review process. But on balance seems worth it to keep the source clean as it's all exposed in source anyways.

@Torres-ssf
Copy link
Contributor

Torres-ssf commented Jul 24, 2023

@danielbate Because you're already integrated typedoc in the existent docs build routine:

"build": "typedoc && vitepress build",

You just need to ignore these two dirs and voilà:

  • src/api/classes
  • src/api/modules

Everything else is already taken care of.

@Torres-ssf can correct me if I'm missing something.

@arboleya If we are about to not commit the generated API files (which I believe is the way to go), we need to also make Typedoc to generate them on the dev script.

@arboleya
Copy link
Member

@Torres-ssf Good point!

@danielbate Maybe something like this would do the trick:

  "dev": "nodemon --config nodemon.config.json -x 'typedoc && vitepress dev'",

@danielbate
Copy link
Contributor Author

@Torres-ssf @arboleya Any reason they were included prior, as I can see they were removed when we moved to vitepress in #811?

@arboleya
Copy link
Member

IIRC, @Torres-ssf changed the way we publish to GH pages, which made it possible.

@danielbate
Copy link
Contributor Author

I'll pick up the new eslint warnings generated by the implementation of tsdoc in #1125

@danielbate danielbate enabled auto-merge (squash) July 25, 2023 08:48
@danielbate danielbate merged commit 999c641 into master Jul 25, 2023
7 checks passed
@danielbate danielbate deleted the db/feat/implement-api-docs branch July 25, 2023 14:28
nedsalk pushed a commit that referenced this pull request Jul 25, 2023
* feat: implement typedoc in docs

* feat: add typedoc to address and interfaces

* feat: generate typedoc docs

* feat: implment typedoc in vitepress

* feat: add api docs readme

* chore: linting

* chore: changeset

* chore: update docs git ignore to exclude built docs

* chore: remove api docs files

* chore: update typedoc config

* docs: update interface typedoc

* feat: include typedoc in vitepress dev script

* feat: reslove tsdoc linting warnings

---------

Co-authored-by: danielbate <--global>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Requests pertinent to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants