package.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. # cleanup
  13. rm -rf ../themes
  14. rm -rf ../vendor
  15. rm -f ../markdown-viewer.zip
  16. mkdir -p ../themes
  17. mkdir -p ../vendor
  18. # build deps
  19. sh bootstrap/build.sh
  20. sh csso/build.sh
  21. sh markdown-it/build.sh
  22. sh marked/build.sh
  23. sh mathjax/build.sh
  24. sh mdc/build.sh
  25. sh mermaid/build.sh
  26. sh mithril/build.sh
  27. sh prism/build.sh
  28. sh remark/build.sh
  29. sh themes/build.sh
  30. # copy files
  31. mkdir -p tmp
  32. mkdir -p tmp/markdown-viewer
  33. cd ..
  34. cp -r background content icons options popup themes vendor LICENSE build/tmp/markdown-viewer/
  35. # copy manifest.json
  36. if [ "$browser" = "chrome" ]; then
  37. cp manifest.chrome.json build/tmp/markdown-viewer/manifest.json
  38. cp manifest.chrome.json manifest.json
  39. elif [ "$browser" = "firefox" ]; then
  40. cp manifest.firefox.json build/tmp/markdown-viewer/manifest.json
  41. cp manifest.firefox.json manifest.json
  42. fi
  43. # archive the markdown-viewer folder itself
  44. if [ "$browser" = "chrome" ]; then
  45. cd build/tmp/
  46. zip -r ../../markdown-viewer.zip markdown-viewer
  47. cd ..
  48. # archive the contents of the markdown-viewer folder
  49. elif [ "$browser" = "firefox" ]; then
  50. cd build/tmp/markdown-viewer/
  51. zip -r ../../../markdown-viewer.zip .
  52. cd ../../
  53. fi
  54. # cleanup
  55. rm -rf tmp/