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

Create API pages for components #74

Open
9 of 10 tasks
fateeand opened this issue May 31, 2023 · 1 comment
Open
9 of 10 tasks

Create API pages for components #74

fateeand opened this issue May 31, 2023 · 1 comment
Assignees
Labels

Comments

@fateeand
Copy link
Collaborator

fateeand commented May 31, 2023

Tasks

  1. composition enhancement
    lukasmatta
  2. composition enhancement
    lukasmatta
  3. composition enhancement
    AtlegangMolokwane fateeand
  4. composition enhancement
    lukasmatta
  5. bug composition
    lukasmatta
  6. composition enhancement
    lukasmatta
  7. bug composition
    lukasmatta
  8. composition enhancement
    lukasmatta
  9. composition enhancement
    lukasmatta
  10. 0 of 3
    composition enhancement
    lukasmatta
@fateeand fateeand added enhancement New feature or request composition labels May 31, 2023
@lukasmatta lukasmatta self-assigned this Sep 7, 2023
@lukasmatta
Copy link
Collaborator

lukasmatta commented Sep 8, 2023

I did a little research on how are two popular UI libraries taking care of their docs generation. Here is the summary:

PrimeNg

Basically, all the logic for API docs generation is inside the build-apidoc.ts file. It uses the TypeDoc tool. The tool is able to iterate over all modules (and for each module over all components) and extract the code docs. Then they use this to generate one JSON file containing API data for all the components.

That JSON file is simply imported in the AppDocApiSection component and the data for currently opened module is loaded from the file (this means that the whole JSON file will become part of final js chunks).

It might be a bit inefficient, one has to load data for all the components even though he might be interested only in one component. The size of the JSON file is 1.12 MB, around 500 kB minified and around 60 kB when transferred gzipped (not that bad considering it contains all the components API info).

image

I think we might get inspiration from the build-apidoc.ts file and use similar solution for our project.

Angular Material

Angular Material team is using tool Dgeni, but as this tool is intended to be used with AngularJS, they are using modified version of it. They basically use it to export API docs into the separate repo in the form of HTML pages.

Their modified version of Dgeni is quite coupled with the build tool Bazel. Some discussion regarding the Dgeni usage with Angular2+ projects is going on in this issue.

DocViewer component is then used to dynamically load those HTML pages into to the appropriate positions in the docs page.


To conclude, I find Angular solution to be more scalable and performant, but also more complex. For now, I'd go the PrimeNg way.

// Edit:
I also looked for some tool to be used, e.g. Storybook or something similar. But I find Storybook to be too complex for us, at least for now. Ng-doc is more about converting MD files to docs, not really about generating API docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants