package.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # exit if any of the intermediate steps fail
  3. set -e
  4. browser=$1
  5. if [ -z "$browser" ]; then
  6. echo "Specify target browser"
  7. echo "chrome, firefox"
  8. exit 1
  9. fi
  10. # set current working directory to directory of the shell script
  11. cd "$(dirname "$0")"
  12. mkdir -p ../themes
  13. mkdir -p ../vendor
  14. # build deps
  15. sh marked/build.sh
  16. sh mathjax/build.sh
  17. sh mdc/build.sh
  18. sh mermaid/build.sh
  19. sh mithril/build.sh
  20. sh prism/build.sh
  21. sh remark/build.sh
  22. sh themes/build.sh
  23. # archive
  24. mkdir -p tmp
  25. mkdir -p tmp/markdown-viewer
  26. cd ..
  27. cp -r background content icons options popup themes vendor build/tmp/markdown-viewer/
  28. if [ "$browser" = "chrome" ]; then
  29. cp manifest.chrome.json build/tmp/markdown-viewer/manifest.json
  30. cp manifest.chrome.json manifest.json
  31. elif [ "$browser" = "firefox" ]; then
  32. cp manifest.firefox.json build/tmp/markdown-viewer/manifest.json
  33. cp manifest.firefox.json manifest.json
  34. fi
  35. # zip the markdown-viewer folder itself
  36. if [ "$browser" = "chrome" ]; then
  37. cd build/tmp/
  38. zip -r ../../markdown-viewer.zip markdown-viewer
  39. cd ..
  40. # zip the contents of the markdown-viewer folder
  41. elif [ "$browser" = "firefox" ]; then
  42. cd build/tmp/markdown-viewer/
  43. zip -r ../../../markdown-viewer.zip .
  44. cd ../../
  45. fi
  46. rm -rf tmp/