A static site based on Jekyll
Here's a one-line command that:
- clears any generated reference docs from cached dir in API
- runs the GraphqlJekyll generator (writes to the cached dir)
- copies the cached reference docs into this repo
- cleans up
- regenerates static Voyager files
cd ../app; \
sudo rm -rf ./tmp/docs*; \
ea bundle exec rails runner 'GraphqlJekyll::Runner.run'; \
cd docs; rm -rf reference/*; \
cp -R ../app/tmp/docs/* ./reference/; \
gco -- reference/operation/query/index.md; \
sudo rm -rf ../app/tmp/docs*; \
ruby generate_voyager_docs.rb YOUR_DEV_API_TOKEN;
The docs are generated on the app container and mounted into the api-docs container.
To regenerate the docs:
docker-compose run --rm app make gql_docs
To view the docs:
docker-compose up api-docs
https://api-docs.groovehq.docker/docs/graphql-api/reference
bundle exec rails runner "GraphQLDocs.build(schema: GrooveSchema.to_definition, output_dir: 'tmp/docs/', base_url: '/graphql-api/reference/dist')"
Copy them to your local docs/ repo
cd stack/docs/
rm -rf graphql-api/reference/dist/ ; mkdir graphql-api/reference/dist/; cp -R ../app/tmp/docs/* graphql-api/reference/dist/
This will go away once we stop hosting on GH Pages without a custom domain. The problem is the root dir of the GH pages site is /docs/ ...
bundle exec rails runner "GraphQLDocs.build(schema: GrooveSchema.to_definition, output_dir: 'tmp/docs/', base_url: '/docs/graphql-api/reference/dist')"
In your local docs/ repo
cd stack/docs/
rm -rf graphql-api/reference/dist/ ; mkdir graphql-api/reference/dist/; cp -R ../app/tmp/docs/* graphql-api/reference/dist/
TODO: Install locally in whatever local ruby (or new docker container). Then hit the GQL API (e.g. on localhost) in the GraphQLDocs.build expression.
(Temporary messy hack.)
To regenerate the Voyager page - with the latest introspection query result
-
Regenerate the introspection query json into the template
bundle exec rails runner doc/APIv2/generate_voyager_docs.rb;
This will write a file under the app dir.
-
Change dir into this repo.
cd ../docs
-
Copy the Voyager HTML file into this repo
cp ../app/tmp/voyager-static.html ./voyager/voyager.html
-
Commit the new voyager file to this repo
git add voyager/voyager.html; git commit;
-
Profit
git co gh-pages
(merge your branch)
git push origin