docs.sh 729 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. if [ "$1" != "build" -a "$1" != "start" ];then
  3. echo "usage: npm run docs (build|start)" >&2
  4. exit 1
  5. fi
  6. set -o errexit
  7. if [ ! -d openzeppelin-docs ]; then
  8. git clone https://github.com/frangio/openzeppelin-docs.git openzeppelin-docs
  9. fi
  10. git -C openzeppelin-docs pull -q
  11. if [ "$1" = "build" ]; then
  12. npm run prepare-docs
  13. cd docs
  14. env DISABLE_PREPARE_DOCS= node ../openzeppelin-docs/build-local.js
  15. elif [ "$1" = "start" ]; then
  16. npx concurrently \
  17. 'nodemon --delay 1 -e "*" -w contracts -w "docs/*.hbs" -x npm run prepare-docs' \
  18. 'cd docs; env DISABLE_PREPARE_DOCS= nodemon --delay 1 -e adoc,yml ../openzeppelin-docs/build-local.js' \
  19. 'http-server -c-1 openzeppelin-docs/build/site'
  20. fi