Updating api-console
-
Run a node container with the core root-dir bind-mounted:
$ docker run -itv $(pwd):/core -w /core node bash
-
Install api-console's recommended cli build tool:
$ npm install -g api-console-cli
-
Generate "standalone" console into
./docs
:$ api-console build https://raw.githubusercontent.com/scitran/core/master/raml/api.raml --output ./docs
Notes:
- This can take a couple minutes
- The
./docs
folder is recreated in the container- Owned by root - use
sudo chown -R $USER:$USER docs
on the host - Intermediate build artifacts can be removed:
$ rm -rf docs/bower_components docs/src
- This readme gets wiped - use
git checkout docs/README.md
- Owned by root - use
-
Enable branch selection via search & replace in
docs/index.html
:document.querySelector("raml-js-parser").loadApi("https://raw.githubusercontent.com/scitran/core/master/raml/api.raml")
var url=new URL(location.href);var branch=new URLSearchParams(url.search).get("branch")||"master";document.querySelector("raml-js-parser").loadApi("https://raw.githubusercontent.com/scitran/core/"+branch+"/raml/api.raml")
-
Test it out:
$ cd docs && python2 -m SimpleHTTPServer
- Visit http://localhost:8000