compile.sh 1.2 KB

1234567891011121314151617181920212223242526
  1. #!/bin/zsh
  2. ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
  3. # compile.sh
  4. #
  5. # This script is made to be called by yabai when Chrome is launched - see
  6. # `yabairc` for details. This often causes the process to fire twice, so the
  7. # program requires a lock. Detailed compilation logs are also kept.
  8. ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
  9. cd $XDG_CONFIG_HOME/surfingkeys/ &&
  10. if mkdir compile.lock 2>/dev/null; then
  11. echo "=== === === === === === === === === === ===" | tee -a compile.log
  12. echo " STARTED " | tee -a compile.log
  13. echo "=== === === === === === === === === === ===" | tee -a compile.log
  14. echo "$(date 2>&1): Compiling" | tee -a compile.log
  15. if [ ! -f package-lock.json ]; then
  16. echo "\t$(npm install 2>&1)" | tee -a compile.log
  17. fi
  18. echo "\t$(npm run build 2>&1)" | tee -a compile.log
  19. rm -rf compile.lock
  20. echo "=== === === === === === === === === === ===" | tee -a compile.log
  21. echo " FINISHED " | tee -a compile.log
  22. echo "=== === === === === === === === === === ===" | tee -a compile.log
  23. echo "" | tee -a compile.log
  24. tail -c 5M compile.log | tee compile.log.temp
  25. mv compile.log.temp compile.log
  26. fi