Skip to content

Commit

Permalink
feat(docs): add astro-graphql-plugin to the documentation (#1814)
Browse files Browse the repository at this point in the history
* Add astro-graphql-plugin

* fix implementedBy links

* fix sidebar highlighting twice

* Update .prettierignore

* remove generated schema MDX

* remove generated graphql docs

* add generated docs content folder to .gitignore

* update astro plugin version to use the new build:start hook

* I don't really know what this does, but magic

* I learned to read comments, Max said to remove this step

* Update pnpm-lock.yaml

* Update index.mdx
  • Loading branch information
AlexLakatos authored Sep 16, 2023
1 parent 2ffdc44 commit c0460ae
Show file tree
Hide file tree
Showing 23 changed files with 75 additions and 12,278 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/lint_test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,6 @@ jobs:
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: exit 1

documentation:
runs-on: ubuntu-22.04
needs: checkout
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/rafiki/env-setup
- name: generate graphql api documentation
run: pnpm --filter documentation docs:graphql:generate && pnpm format
- name: verify changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files

- name: fail if docs were generated
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: exit 1

backend:
runs-on: ubuntu-22.04
needs: [checkout]
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ build
.docusaurus
.cache-loader
postman
.postman
.postman
packages/documentation/src/content/docs/apis
6 changes: 5 additions & 1 deletion packages/documentation/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# build output
dist/

# generated types
.astro/

# generated docs
src/content/docs/apis/auth/*
src/content/docs/apis/backend/*

# dependencies
node_modules/

Expand All @@ -12,7 +17,6 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production
Expand Down
31 changes: 18 additions & 13 deletions packages/documentation/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import react from '@astrojs/react'

import remarkMath from 'remark-math'
import rehypeMathjax from 'rehype-mathjax'
import GraphQL from 'astro-graphql-plugin'

// https://astro.build/config
export default defineConfig({
Expand Down Expand Up @@ -153,28 +154,32 @@ export default defineConfig({
{
label: 'Backend Admin API',
collapsed: true,
items: [
{
label: 'Schema types',
link: 'apis/backend/schema/'
}
]
autogenerate: {
directory: 'apis/backend'
}
},
{
label: 'Auth Admin API',
collapsed: true,
items: [
{
label: 'Schema types',
link: 'apis/auth/schema/'
}
]
autogenerate: {
directory: 'apis/auth'
}
}
]
}
]
}),
react()
react(),
GraphQL({
schema: '../backend/src/graphql/schema.graphql',
output: './src/content/docs/apis/backend/',
linkPrefix: '/apis/backend/'
}),
GraphQL({
schema: '../auth/src/graphql/schema.graphql',
output: './src/content/docs/apis/auth/',
linkPrefix: '/apis/auth/'
})
],
// Process images with sharp: https://docs.astro.build/en/guides/assets/#using-sharp
image: {
Expand Down
6 changes: 2 additions & 4 deletions packages/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"docs:graphql:generate:backend": "./node_modules/.bin/graphql-markdown ../backend/src/graphql/schema.graphql > src/schema-dumps/backend_raw_schema.md",
"docs:graphql:generate:auth": "./node_modules/.bin/graphql-markdown ../auth/src/graphql/schema.graphql > src/schema-dumps/auth_raw_schema.md"
"astro": "astro"
},
"dependencies": {
"@astrojs/react": "^2.3.2",
"@astrojs/starlight": "^0.7.3",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"astro": "2.10.15",
"astro-graphql-plugin": "^0.0.7",
"graphql": "^16.8.0",
"graphql-markdown": "^7.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rehype-mathjax": "^4.0.3",
Expand Down
67 changes: 0 additions & 67 deletions packages/documentation/src/content/docs/apis/auth/enums.md

This file was deleted.

99 changes: 0 additions & 99 deletions packages/documentation/src/content/docs/apis/auth/inputObjects.md

This file was deleted.

79 changes: 0 additions & 79 deletions packages/documentation/src/content/docs/apis/auth/interfaces.md

This file was deleted.

Loading

0 comments on commit c0460ae

Please sign in to comment.