Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.83 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. set -xev
  4.  
  5. display_usage() {
  6.     echo "usage: sh "${0}" [flags]"
  7.     echo "the list of flags:"
  8.     echo "   -b flag to build"
  9.     echo "   -d flag to build and deploy"
  10. }
  11.  
  12. build() {
  13.     mkdir -p public/js
  14.     mkdir -p public/css
  15.  
  16.     export REACT_APP_API=http://crd-api.us-east-1.elasticbeanstalk.com
  17.  
  18.     rm -rf node_modules
  19.     rm -rf build
  20.     npm i
  21.     npm run build
  22.     cp build/static/js/main*.js public/js/main.js
  23.     cp build/static/css/main*.css public/css/main.css
  24. }
  25.  
  26. if [ $# -le 1 ]
  27. then
  28.     display_usage
  29.     exit 1
  30. fi
  31.  
  32.  
  33. while getopts db option
  34. do
  35.     case ${option} in
  36.         b)
  37.             BUILD=1
  38.             ;;
  39.         d)
  40.             DEPLOY=1
  41.             ;;
  42.     esac
  43. done
  44.  
  45. if [[ BUILD -e 1 ]]
  46. then
  47.     build()
  48. fi
  49.  
  50. if [[ DEPLOY -e 1 ]]
  51. then
  52.     eb deploy
  53. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement