-
Notifications
You must be signed in to change notification settings - Fork 84
feat: add vitepress #6866
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?
feat: add vitepress #6866
Conversation
4b7e41c to
147a4bd
Compare
serhalp
left a comment
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.
Thank you, Dario! Looks great overall — just a bit of a conundrum around what settings to populate 🤔.
| command: 'vitepress build', | ||
| directory: '.vitepress/dist', |
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.
🤔 Hmm, VitePress is an interesting case because of https://vitepress.dev/guide/routing#root-and-source-directory. It's doubly strange because the "project root" isn't even configurable; it's an ephemeral concept specified on the command line 🙃.
vitepress build foo emits build output into ./foo/.vitepress/dist. VitePress calls ./foo here the "project root". If you run vitepress build without a root arg, root is set to pwd, so the output ends up in ./vitepress/dist. This isn't entirely a build output concern—the project root is where the VitePress config file is expected, etc. so it needs to be correct.
🤔🤔🤔
I don't think it's possible to make this perfect. Perhaps the best we can do is use their current recommended config, which is compatible with the defaults emitted by npx vitepress init (i.e. project root = ./docs).
| command: 'vitepress build', | |
| directory: '.vitepress/dist', | |
| command: 'vitepress build docs', // ideally we don't use `npm run build:docs` here due to pnpm, etc. | |
| directory: 'docs/.vitepress/dist', |
What do you think? We could do some hacky things inspecting the user build command, but I'm not sure that's worth the complexity...
| category = Category.SSG | ||
|
|
||
| dev = { | ||
| command: 'vitepress dev', |
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.
See discussion below. If we want this to align with the defaults from npx vitepress init, we should use:
| command: 'vitepress dev', | |
| command: 'vitepress dev docs', |
| @@ -0,0 +1,25 @@ | |||
| import { BaseFramework, Category, Framework } from './framework.js' | |||
|
|
|||
| export class VitePress extends BaseFramework implements Framework { | |||
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.
Let's add vitepress to the big list of excluded dependencies for vite: https://github.com/dario-piotrowicz/netlify-build/blob/796ebb173d716151fe0e864c724be1e67c1cdd1c/packages/build-info/src/frameworks/vite.ts#L7
Huh, never mind, vitepress projects don't have a direct dependency on vite!
This PR adds VitePress detection.
This PR is a recreation of #6630 from @TheAlexLichter since that PR got quite stale for a while (I hope you don't mind Alex 😄🙏)
For us to review and ship your PR efficiently, please perform the following steps:
we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
something that`s on fire 🔥 (e.g. incident related), you can skip this step.
your code follows our style guide and passes our tests.
A picture of a cute animal (not mandatory, but encouraged)