rebuild-docs.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Extract the OpenAPI specification.
  2. # 1) Check that there is only one parameter
  3. # of Wekan version number:
  4. if [ $# -ne 1 ]
  5. then
  6. echo "Syntax with Wekan version number:"
  7. echo " ./rebuild-docs.sh 5.10"
  8. exit 1
  9. fi
  10. # 2) If esprima-python directory does not exist,
  11. # install dependencies.
  12. if [ ! -d ~/python/esprima-python ]; then
  13. sudo apt-get -y install python3-pip python3-swagger-spec-validator python3-wheel python3-setuptools
  14. # Install older version of api2html that works with Node.js 14
  15. sudo npm install -g api2html@0.3.0 || sudo npm install -g swagger-ui-watcher
  16. (mkdir -p ~/python && cd ~/python && git clone --depth 1 -b master https://github.com/Kronuz/esprima-python)
  17. (cd ~/python/esprima-python && git fetch origin pull/20/head:delete_fix && git checkout delete_fix && sudo python3 setup.py install --record files.txt)
  18. #(cd ~/python/esprima-python && git fetch origin pull/20/head:delete_fix && git checkout delete_fix && sudo pip3 install .)
  19. # temporary fix until https://github.com/Kronuz/esprima-python/pull/20 gets merged
  20. # a) Generating docs works on Kubuntu 21.10 with this,
  21. # but generating Sandstorm WeKan package does not work
  22. # https://github.com/wekan/wekan/issues/4280
  23. # https://github.com/sandstorm-io/sandstorm/issues/3600
  24. # sudo pip3 install .
  25. # b) Generating docs Works on Linux Mint with this,
  26. # and also generating Sandstorm WeKan package works:
  27. # sudo python3 setup.py install --record files.txt
  28. fi
  29. # 2) Go to Wekan repo directory
  30. cd ~/repos/wekan
  31. # 3) Create api docs directory, if it does not exist
  32. if [ ! -d public/api ]; then
  33. mkdir -p public/api
  34. fi
  35. # 4) Generate docs with api2html or fallback to swagger-ui-watcher
  36. python3 ./openapi/generate_openapi.py --release v$1 > ./public/api/wekan.yml
  37. if ! api2html -c ./public/logo-header.png -o ./public/api/wekan.html ./public/api/wekan.yml; then
  38. swagger-ui-watcher ./public/api/wekan.yml -p 8080
  39. fi
  40. # Copy docs to bundle
  41. #cp -pR ./public/api ~/repos/wekan/.build/bundle/programs/web.browser/app/