First you need to fork some projects and configure them correctly to set up the documentation independent generation pipeline.
- Fork the following repos (it means open the links and click on Fork button in the top right corner of the page):
- API Doc portal template: https://github.com/YaaS/docpad-skeleton-apidocs
- Sample REST API microservice that we will be documenting: https://github.com/derberg/minerva
- Sample registry that integrates the template and docu sources: https://github.com/derberg/apidoc-workshop-docu_registry
- Configuration
Config edits can be done through github.com UI or by using Git CLI or GitHub Desktop.
- Modify
chewieConfig.jsfile in forkeddocpad-skeleton-apidocsrepository. Change thepathattribute to:
path: process.env.REGISTRY_PATH || 'https://github.com/your_github_username/apidoc-workshop-docu_registry.git',
- Modify
minerva.jsonfile in forkedapidoc-workshop-docu_registryrepository. Change thelocationattribute:
"location": "https://github.com/your_github_username/minerva",
If configuration is completed you have to:
- Clone your forked
docpad-skeleton-apidocsrepository, - Navigate to its local clone in the terminal,
- Call the following command:
npm run prepareto install all the dependencies - Now call
npm run initto install inject content into the template - Call
npm run startto start documentation server locally - Once the start is completed, open in the browser the following link: http://127.0.0.1:9778/
The easiest solution is to publish the API Doc portal on GitHub pages as this service is for free. Of course the generated API Doc portal files can be hosted on any other server as it is pure static content.
-
Create new repository with the following name:
your_github_username.github.io. It must be public and initialized (You do it in UI during creation, just initialize with a readme file). -
Modify
chewieConfig.jsfile in forkeddocpad-skeleton-apidocsrepository.
- Change the
srcLocationattribute:
srcLocation: 'https://github.com/your_github_username/your_github_username.github.io.git',
- Change the
docuUrlattribute:
docuUrl: process.env.docuURL || 'https://your_github_username.github.io',
- Modify
docpad.coffeefile in forkeddocpad-skeleton-apidocsrepository. Change theurlattribute in the following way:
environments:
prod:
templateData:
site:
url: "https://your_github_username.github.io"
- Navigate to the local clone of
docpad-skeleton-apidocsrepository in the terminal and do"
git pull
npm run init
- Call the following command:
- On Linux/Mac OS:
NODE_ENV=prod npm run compile - On Windows OS:
set NODE_ENV=prodnpm run compile
- Call the following command:
- On Linux/Mac OS:
npm run preparePushResult && npm run pushResult - On Windows OS:
npm run preparePushResultnpm run pushResult
- Once the push is completed, open in the browser the following link: http://your_github_username.github.io