-
Notifications
You must be signed in to change notification settings - Fork 10
Documentation for dev and copilot #4384
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
base: main
Are you sure you want to change the base?
Conversation
…luding component documentation
…iting them completely
…copy them to component folder
…egrate it into [component].md
```jsonc | ||
// scripts/package.json | ||
"copilot:typedoc": "typedoc --options ../typedoc.json --tsconfig tsconfig.typedoc.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```jsonc | |
// scripts/package.json | |
"copilot:typedoc": "typedoc --options ../typedoc.json --tsconfig tsconfig.typedoc.json", | |
```bash | |
npm run copilot:typedoc --workspace=scripts |
I'm struggling on where to put this documentation. Either at this place to have it near the script, or within docs/
folder in the root directory. The latter would ensure that it's easily discoverable in between the rest of the documentation, which might be slightly better. Afterwards we would have to change the commands within this file to bash
instead of listing the scripts themselves.
scripts/documentation/README.md
Outdated
|
||
### 1.1 Annotate components and generate component Markdown | ||
|
||
Annotate your components with [JSDoc](https://jsdoc.app/) (classes, properties, etc.) so TypeDoc can pick up API signatures. Then generate the component API documentation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it pretty clear on what command to run for generating the documentation. But maybe we should add a least a sentence or two regarding how the annotation is being done exactly (without putting the pressure on the reader to go through the documentation of JSDoc), and even also provide a path to one of the documentations that we've already prepared for someone to adapt from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an example showing how to annotate a component
scripts/documentation/README.md
Outdated
|
||
### 1.3 Annotate CSS variables and extract CSS docs | ||
|
||
Ensure, that all CSS variables of your component (starting with `--db-...` in the `[component].scss`) are annotated with [SassDoc](http://sassdoc.com/). Then run the script. It scans `packages/components/src/components` for subfolders (each component) and loads each component's SCSS file and transforms them into Markdown. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it pretty clear on what command to run for generating the documentation. But maybe we should add a least a sentence or two regarding how the annotation is being done exactly (without putting the pressure on the reader to go through the documentation of SassDoc), and even also provide a path to one of the documentations that we've already prepared for someone to adapt from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an example showing how to annotate a component
|
||
### 1.2 Generate code examples via Mitosis | ||
|
||
Create a `*.docs.lite.tsx` file in the docs directory of the component containing examples for your component. Then run the Mitosis build to extract code snippets (React, Angular, Vue) from your `*.docs.lite.tsx` files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While going through those examples, I was thinking about whether we could generate those out of the existing JSON data that we've set up to generate the documentation pages; those could (or even should?) be equal most of the time and we wouldn't need to do duplicate work or go out of sync or missing to update some documentation by a single source of truth.
|
||
```jsonc | ||
// scripts/package.json | ||
"copilot:extract-css": "node documentation/extract-css-vars.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'm missing something here, but this command doesn't generate any CSS contents at the moment, not even for the button component, in which to my understanding some of these annotations are even already included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added a commented scss file (drawer). After running the script, I get the corresponding markdown created (drawer.css.md).
import { promises as fs } from 'node:fs'; | ||
import path from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import fg from 'fast-glob'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use fast-glob
here? In other files we use glob
Proposed changes
closes #1349
Types of changes
Further comments