question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I use nodejs to call Vitepress's API?

See original GitHub issue

Is your feature request related to a problem? Please describe.

Can I use nodejs to call Vitepress’s API?Or will there be such a change in the future?

Because I want to encapsulate VitePress to make it easier to generate some functionally similar documents in different projects, rather than duplicating VitePress configuration in different projects.

Describe the solution you’d like

Use an API like this in nodejs:

vuepress.dev({
// some config or specify the configuration file location
})

vuepress.build({
// some config or specify the configuration file location
})

Describe alternatives you’ve considered

No response

Additional context

No response

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yangmiao7commented, Oct 20, 2022

@brc-dd First of all thanks for your reply.

I did read part of the source code,But haven’t tried coding my program yet.

My consideration is that these APIs are not officially exposed (or written in the document), and future updates of Vitepress may cause these methods to not be used correctly, and it will be difficult for my program to use the latest and better Vitepress.

So my other question is, will there be an official node-api for users in the future?

0reactions
brc-ddcommented, Oct 20, 2022

So, in your wrapper you will need to install vitepress and write some stuff like this:

image

I mentioned that cli.ts file for reference on how to use those three functions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTPS | Node.js v19.3.0 Documentation
In such cases, attempting to import from https or calling require('node:https') will result in an error being thrown. When using CommonJS, the error...
Read more >
API Reference | VitePress
VitePress offers several built in API to let you access app data. VitePress also comes with few built-in component that can be used...
Read more >
vuejs/vitepress: Vite & Vue powered static site generator.
It is already suitable for out-of-the-box documentation use, but the config and theming API may still change between minor releases.
Read more >
vitepress - npm
Currently, it's in the alpha stage. It is already suitable for out-of-the-box documentation use, but the config and theming API may still change ......
Read more >
How to Make Secure HTTP Requests with Vue and Express
Learn how to build a secure Express API and make API calls to it from ... can use JavaScript across the board: on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found