2
0

open-example-projects.sh 538 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. # always immediately exit upon error
  3. set -e
  4. # start in root
  5. cd "`dirname $0`/.."
  6. root_dir="$PWD"
  7. for package_file in example-projects/*/package.json
  8. do
  9. cd "$(dirname $package_file)"
  10. dist_html_files=$(find dist -name '*.html')
  11. if [[ "$dist_html_files" ]]
  12. then
  13. for html_file in "$dist_html_files"
  14. do
  15. open -a "Google Chrome" "file://$PWD/$html_file"
  16. done
  17. else
  18. for html_file in *.html
  19. do
  20. open -a "Google Chrome" "file://$PWD/$html_file"
  21. done
  22. fi
  23. cd "$root_dir"
  24. done