SetupEnvironment.sh 955 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # Setup all the environment requirements.
  3. REQUIRED_APPLICATIONS=('node' 'go' 'npm')
  4. for i in "${REQUIRED_APPLICATIONS[@]}"; do
  5. if ! command -v $i &> /dev/null
  6. then
  7. echo "${i} could not be found, please install to be able to execute dev environment"
  8. exit
  9. fi
  10. done
  11. if ! command -v air &> /dev/null
  12. then
  13. printf "\n"
  14. read -p "cosmtrek/air is required to continue, do you want to install it? y/N: " -n 1 -r
  15. if [[ $REPLY =~ ^[Yy]$ ]]
  16. then
  17. echo "Yes"
  18. curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
  19. printf "\nInstalled Air\n"
  20. air -v
  21. else
  22. printf "\nCanceled script, exiting program\n"
  23. exit
  24. fi
  25. fi
  26. if [[ ! -d ./dashboard/node_modules ]]; then
  27. echo "Couldn't find node_modules, installing npm packages"
  28. cd ./dashboard && npm install --legacy-peer-deps;
  29. cd ../;
  30. else
  31. echo "Node modules found! Proceeding to start server"
  32. fi