Skip to content

Commit

Permalink
(docs): Minor Docusaurus setup updates (#6381)
Browse files Browse the repository at this point in the history
* Minor Docusaurus setup updates

* Updates from Barret's review
  • Loading branch information
dthyresson authored and jtoar committed Mar 8, 2023
1 parent ff941c9 commit 8340b0a
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions docs/docs/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,14 @@ If your project uses [Docusaurus](https://docusaurus.io), the generated commente

The following is some basic setup information, but please consult [Docusaurus](https://docusaurus.io) and the [graphql-markdown](https://graphql-markdown.github.io) for latest instructions.

1. Add `docs` to your `workspaces` in the project's `package.json`:
1. Install Docusaurus (if you have not done so already)

```terminal
npx create-docusaurus@latest docs classic
```


Add `docs` to your `workspaces` in the project's `package.json`:
```
"workspaces": {
Expand All @@ -2181,19 +2188,30 @@ The following is some basic setup information, but please consult [Docusaurus](h
},
```
2. Create a `docs` directory at the root of your project
2. Ensure a `docs` directory exists at the root of your project
```terminal
mcd docs
`
mkdir docs // if needed
```
3. Install the plugin
3. Install the GraphQL Generators Plugin
```terminal
yarn add @edno/docusaurus2-graphql-doc-generator graphql
yarn workspace docs add @edno/docusaurus2-graphql-doc-generator graphql
```
4. Ensure a Directory for your GraphQL APi generated documentation resides in with the Docusaurus directory `/docs` structure
```terminal
// Change into the "docs" workspace
cd docs
// you should have the "docs" directory and within that a "graphql-api" directory
mkdir docs/graphql-api // if needed
```
4. Update `docs/docusaurus.config.js` and configure the plugin and navbar
5. Update `docs/docusaurus.config.js` and configure the plugin and navbar
```
// docs/docusaurus.config.js
Expand All @@ -2205,7 +2223,6 @@ yarn add @edno/docusaurus2-graphql-doc-generator graphql
schema: '../.redwood/schema.graphql',
rootPath: './docs',
baseURL: 'graphql-api',
homepage: './docs/graphql-api/generated.md',
linkRoot: '../..',
},
],
Expand All @@ -2224,11 +2241,11 @@ themeConfig:
{
to: '/docs/graphql-api', // adjust the location depending on your baseURL (see configuration)
label: 'GraphQL API', // change the label with yours
position: 'left',
position: 'right',
},
//...
```
5. Update `docs/sidebars.js` to include the generated `graphql-api/sidebar-schema.js`
6. Update `docs/sidebars.js` to include the generated `graphql-api/sidebar-schema.js`
```
// docs/sidebars.js
Expand Down Expand Up @@ -2260,7 +2277,7 @@ const sidebars = {
module.exports = sidebars
```
6. Generate the docs
7. Generate the docs
`yarn docusaurus graphql-to-doc`
Expand All @@ -2270,7 +2287,7 @@ You can overwrite the generated docs and bypass the plugin's diffMethod use `--f
``yarn docusaurus graphql-to-doc --force`
:::
7. Start Docusaurus
8. Start Docusaurus
```
yarn start
Expand Down

0 comments on commit 8340b0a

Please sign in to comment.