facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.48k stars 8.48k forks source link

Support monorepos with multiple docs plugins #4085

Open vjpr opened 3 years ago

vjpr commented 3 years ago

I am creating this issue to track all the issues related to using multiple docs plugins without a single repo.

Below is an example of my setup:

- . <- plugin-content-docs path
- .git
- tmp/logs
- .tmp/more-logs
- readme.md
- package.json
- docs <- docs for the monorepo
  - sidebar.js
  - readme.md 
- packages
  - docs-app
    - package.json
    - docusaurus.config.js 
  - pkg1 <- plugin-content-docs path
    - docs
      - sidebar.js
      - readme.md
  - pkg2 <- plugin-content-docs path
    - docs 

There are 3 docs plugins in use here. One for the monorepo root package, and two others for other packages.

I have indicated where the plugin's path config is set.

For the monorepo root docs plugin I set the path to be the root rather than the docs folder. This allows me to include the readme.md file in my docs.

Issues

armano2 commented 3 years ago

@vjpr there is a way to setup this, maybe not as straight, but you could look what i did in typescript-eslint

https://github.com/typescript-eslint/typescript-eslint/pull/3147

https://github.com/typescript-eslint/typescript-eslint/blob/2abb09226d9158e67f9d4c91b30c50cadc4de3c6/website/docusaurus.config.js#L33-L52

    [
      '@docusaurus/plugin-content-docs',
      {
        id: 'rules-docs',
        path: '../packages/eslint-plugin/docs/rules',
        sidebarPath: require.resolve('./sidebars/sidebar.rules.js'),
        routeBasePath: 'rules',
        editUrl: `${githubUrl}/edit/master/docs/`,
        remarkPlugins,
      },
    ],
    [
      '@docusaurus/plugin-content-docs',
      {
        id: 'base-docs',
        path: '../docs',
        routeBasePath: 'docs',
        sidebarPath: require.resolve('./sidebars/sidebar.base.js'),
        editUrl: `${githubUrl}/edit/master/docs/`,
        remarkPlugins,
      },
    ],
blessanm86 commented 1 year ago

We are using docusaurus in our NX monorepo. The docs is 1 app. It would be great if we could specify folders outside the docs app. This way we could pull the docs from other apps and libs folder.