package.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 panzoom/build.sh
  28. sh prism/build.sh
  29. sh remark/build.sh
  30. sh themes/build.sh $browser
  31. # copy files
  32. mkdir -p tmp
  33. mkdir -p tmp/markdown-viewer
  34. cd ..
  35. cp -r background content icons options popup themes vendor LICENSE build/tmp/markdown-viewer/
  36. # copy manifest.json
  37. if [ "$browser" = "chrome" ]; then
  38. cp manifest.chrome.json build/tmp/markdown-viewer/manifest.json
  39. cp manifest.chrome.json manifest.json
  40. elif [ "$browser" = "firefox" ]; then
  41. cp manifest.firefox.json build/tmp/markdown-viewer/manifest.json
  42. cp manifest.firefox.json manifest.json
  43. fi
  44. # archive the markdown-viewer folder itself
  45. if [ "$browser" = "chrome" ]; then
  46. cd build/tmp/
  47. zip -r ../../markdown-viewer.zip markdown-viewer
  48. cd ..
  49. # archive the contents of the markdown-viewer folder
  50. elif [ "$browser" = "firefox" ]; then
  51. cd build/tmp/markdown-viewer/
  52. zip -r ../../../markdown-viewer.zip .
  53. cd ../../
  54. fi
  55. # cleanup
  56. rm -rf tmp/