This website is built using Docusaurus 2, a modern static website generator.
The live site is at https://dev.shipperhq.com/ .
- Set up Git: https://stackoverflow.com/c/shipperhq/questions/481
- Set up ssh key: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- Install npm: https://nodejs.org/en/download/
- Install 'yarn' via npm: https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable
git clone https://dev.shipperhq.com/
ls
-> verify shipperhq.github.io is listedcd shipperhq.github.io
cd dev-shipperhq
yarn
yarn start
Go to http://localhost:3000/ to see the site!
Optional: create a .env
file and add your GitHub username. Use .env.template
as an example.
yarn build
yarn serve
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
- this command is a convenient way to build the website and push to thegh-pages
branch. This command automatically deploys your local changes to the live site.
yarn start
- Starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.yarn build
- Generates static content into thebuild
directory.yarn serve
- Serves the built website locally.yarn deploy
- Pushes to thegh-pages
branch and publishes the website to GitHub pages.yarn rate-service-graphql
- generates graphQL docs for rate service usinghttps://api.shipperhq.com/v2/graphql
for insprospection.yarn order-view-service-graphql
- generates graphQL docs for order view service usinghttps://ovs.shipperhq.com
for insprospectionyarn run docusaurus docs:version 1.1.0
- copies docs into a versioned directory and marks docs with that specified version.
gh-pages
- The branch to deploy the static files to.
/blog/
- Contains the blog Markdown files. You can delete the directory if you do not want/need a blog. More details can be found in the blog guide./docs/
- Contains the Markdown files for the docs. Customize the order of the docs sidebar insidebars.js
. More details can be found in the docs guide./src/
- Non-documentation files like pages or custom React components. You don't have to strictly put your non-documentation files in here but putting them under a centralized directory makes it easier to specify in case you need to do some sort of linting/processing./src/pages
- Any files within this directory will be converted into a website page. More details can be found in the pages guide.
/static/
- Static directory. Any contents inside here will be copied into the root of the finalbuild
directory./docusaurus.config.js
- A config file containing the site configuration. More details can be found in the api docs./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.
- Run the command with the new version number
yarn run docusaurus docs:version 1.1.0
- When tagging a new version, the document versioning mechanism will:
- Copy the full
docs/
folder contents into a newversioned_docs/version-<version>/
folder. - Create a versioned sidebars file based from your current sidebar configuration (if it exists) - saved as
versioned_sidebars/version-<version>-sidebars.json
. - Append the new version number to
versions.json
.
- Copy the full
- Create a
config.yml
file inside of thespectaql-configs
directory. (Ex file: rate-service-config.yml) - Copy/paste the contents of an existing config file. Set the API URL and any other settings needed.
- Inside of the
spectaql-data
directory, create ametadata.json
file. (Ex file: rate-service-metadata.json) - Change the metadata file path in the corresponding config file.
- Inside of the
static
directory, create a new directory. This is where your graphQL docs will output. (Ex directory: rate-service) - In package.json, add a new command with the updated file names. (See other spectaql commands for reference.)
- Run command to generate docs
- Run the spectaql command for the API you would like to regenerate. See package.json for commands. (Ex.
yarn rate-service-spectaql
) - If the server was currently modified, you can pull down those changes on the server repo and point the server endpoint for spectaql to your local env. This will regenerate the docs using your local API endpoint, so you don't have to wait for the server changes to be deployed.
- Make sure you do not push up the API endpoint changes since this is temporary.
- You will need to change the server URL in the corresponding index.html file.
- Ex. In ovs-config.yml, I changed the ovs.shipperhq.com endpoint to localhost:4060. I ran the spectaql command to regenerate docs. Then I changed the server url in insights-service/index.html back to ovs.shipperhq.com.
- You can hide fields inside of the metadata.json file. See rate-service-metadata.json for reference.
- Run the spectaql command for that API to regenerate docs with new config.