Skip to content

Conversation

@bluwy
Copy link
Member

@bluwy bluwy commented Dec 12, 2025

Related: #19436

Preview link: https://deploy-preview-21270--vite-docs-main.netlify.app/guide/cli

The flow:

  1. Generate docs/_data/cli-vite.json from docs/.vitepress/updateData.config.ts (called on vitepress config load)
  2. docs/_data/cli-vite.data.ts loads the JSON and formats as HTML.
  3. docs/guide/cli.md loads the HTML and renders it.

I separated step 1 & 2 as two steps so that translators can directly translate on the docs/_data/cli-core.json file. Maybe there's a better way to organize the source of truth but I went with this for now to prevent editing the CLI code too much.


Other changes:

  • Added --profile flag to CLI help message, so the generation also picks it up. A caveat however is that it's missing a link to the performance page.
  • I removed the h2 grouping in the CLI page as I didn't think it provided much value. The h2s are now the commands directly.

@sapphi-red sapphi-red added the documentation Improvements or additions to documentation label Dec 12, 2025
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Nice ✨

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it's better to generate the json when bundling the vite package. Then, cli.js would always exist.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should add this file to

git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF docs package.json pnpm-lock.yaml netlify.toml packages/vite/package.json scripts/docs-check.sh

so that the docs are built when this file changes.

Comment on lines +23 to +24
<!-- render as html -->
<div v-html="data.viteDevFlags"></div>
Copy link
Member

Choose a reason for hiding this comment

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

One downside of using HTML tags is that the md files does not contain the content: https://deploy-preview-21270--vite-docs-main.netlify.app/guide/cli.md
I guess it's ok for now.

Comment on lines +72 to +76
## Shared Options

These options are available for all commands.

<div v-html="data.globalFlags"></div>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should put this as the first item? I think it's difficult to notice that these options exists.
An alternative would be to link to this section from all "Options" sections or duplicating these into all "Options".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants