Skip to content

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

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

michaelmkraus
Copy link
Contributor

@michaelmkraus michaelmkraus commented Jun 16, 2025

Proposed changes

  • Generate context for copilot and generate documentation for developers

closes #1349

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (fix on existing components or architectural decisions)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Further comments

@michaelmkraus michaelmkraus self-assigned this Jun 16, 2025
@michaelmkraus michaelmkraus added the 📕documentation Improvements or additions to documentation label Jun 16, 2025
@mfranzke mfranzke changed the title Documentation for dev and copilo Documentation for dev and copilot Jul 4, 2025
@mfranzke mfranzke added the 🪩🔥🕺coolTopic some relevant topics, that we even also need to report in different rounds / to stakeholders label Jul 16, 2025
Comment on lines +11 to +13
```jsonc
// scripts/package.json
"copilot:typedoc": "typedoc --options ../typedoc.json --tsconfig tsconfig.typedoc.json",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
```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.


### 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:
Copy link
Collaborator

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.

Copy link
Contributor Author

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.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.
Copy link
Collaborator

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.

Copy link
Contributor Author

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:
Copy link
Collaborator

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",
Copy link
Collaborator

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.

Copy link
Contributor Author

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';
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪩🔥🕺coolTopic some relevant topics, that we even also need to report in different rounds / to stakeholders 📕documentation Improvements or additions to documentation
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Talk about a Styling API
3 participants