mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 23:08:54 +02:00
docs: mention setup in monorepo (#6297)
* Add Monorepos * elaborate * elaborate Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
9e1b364841
commit
52e097e2c1
1 changed files with 22 additions and 0 deletions
|
@ -100,6 +100,28 @@ my-website
|
|||
- `/package.json` - A Docusaurus website is a React app. You can install and use any npm packages you like in them
|
||||
- `/sidebar.js` - Used by the documentation to specify the order of documents in the sidebar
|
||||
|
||||
### Monorepos
|
||||
|
||||
If you are using Docusaurus for documentation of an existing project, a monorepo may be the solution for you. Monorepos allow you to share dependencies between similar projects. For example, your website may use your local packages to showcase the latest features, instead of depending on a released version; your contributors can also conveniently update the docs as they implement features. An example monorepo folder structure is below:
|
||||
|
||||
```bash
|
||||
my-monorepo
|
||||
├── package-a # Another package, your actual project
|
||||
│ ├── src
|
||||
│ └── package.json # Package A's dependencies
|
||||
├── website # Docusaurus root
|
||||
│ ├── docs
|
||||
│ ├── src
|
||||
│ └── package.json # Docusaurus' dependencies
|
||||
├── package.json # Monorepo's shared dependencies
|
||||
```
|
||||
|
||||
In this case, you should run `npx create-docusaurus` within the `./my-monorepo` folder.
|
||||
|
||||
If you're using a hosting provider such as Netlify or Vercel, you will need to change the `Base directory` of the site to where your Docusaurus root is. In this case, that would be `./website`. Read more about configuring ignore commands in the [deployment docs](./deployment.mdx#deploying-to-netlify).
|
||||
|
||||
Read more about monorepos in the [Yarn documentation](https://yarnpkg.com/features/workspaces) (Yarn is not the only way to set up a monorepo, but it's a common solution), or checkout [Docusaurus](https://github.com/facebook/docusaurus) and [Jest](https://github.com/facebook/jest) for some real-world examples.
|
||||
|
||||
## Running the development server {#running-the-development-server}
|
||||
|
||||
To preview your changes as you edit the files, you can run a local development server that will serve your website and reflect the latest changes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue