build-example-repos.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/usr/bin/env bash
  2. #
  3. # Give a --recent-release flag to test against the currently live release
  4. #
  5. set -e # always immediately exit upon error
  6. cd "`dirname $0`/.." # start in project root
  7. proj_dir="$PWD"
  8. if [[ "$1" == '--recent-release' ]]
  9. then
  10. use_current=0
  11. else
  12. use_current=1
  13. # temporarily make this fullcalendar project global
  14. npm link
  15. fi
  16. success=1
  17. for example_path in tests/example-repos/*
  18. do
  19. # has npm build system? then build
  20. if [[ -f "$example_path/package.json" ]]
  21. then
  22. cd "$example_path"
  23. # start with fresh dependencies
  24. rm -f "package-lock.json"
  25. rm -rf "node_modules"
  26. # link to the globally linked fullcalendar
  27. # (must be done before `npm install`)
  28. if [[ "$use_current" == '1' ]]
  29. then
  30. npm link fullcalendar
  31. fi
  32. npm install
  33. if npm run build
  34. then
  35. echo
  36. echo "Successfully built `basename $example_path`"
  37. echo
  38. else
  39. echo
  40. echo "Failed to build `basename $example_path`"
  41. echo
  42. success=0
  43. fi
  44. fi
  45. # return to project root, for next iteraion, and for after loop
  46. cd "$proj_dir"
  47. done
  48. # unlink global fullcalendar
  49. if [[ "$use_current" == '1' ]]
  50. then
  51. npm unlink
  52. fi
  53. if [[ "$success" == '1' ]]
  54. then
  55. echo
  56. echo "Successfully built all example repos."
  57. echo
  58. else
  59. echo
  60. echo "Failed to build all example repos."
  61. echo
  62. exit 1
  63. fi