cdnjs-commit.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env bash
  2. cd "`dirname $0`/.."
  3. proj_dir="$PWD"
  4. echo
  5. echo "This script assumes the following:"
  6. echo "1. You have run the release script"
  7. echo "2. You have a clone of CDNJS's repo with remotes 'upstream' and 'origin'"
  8. echo "3. You have initialized CDNJS's repo with 'npm install'"
  9. echo
  10. # 1. make a fork of cdnjs on github
  11. # 2. clone the fork from github (which will be the 'origin')
  12. # 3. `git remote add upstream [email protected]:cdnjs/cdnjs.git`
  13. version=$(sed -n 's/^.*"version" *: *"\([^"]*\)".*$/\1/p' package.json)
  14. cdnjs_dir="$HOME/Scratch/cdnjs"
  15. echo "FullCalendar version: $version"
  16. echo "Default CDNJS directory: $cdnjs_dir"
  17. echo
  18. echo "Enter the location of the CDNJS directory. To keep the default, press enter."
  19. read cdnjs_dir_override
  20. if [[ "$cdnjs_dir_override" ]]
  21. then
  22. cdnjs_dir="$cdnjs_dir_override"
  23. fi
  24. echo "Updating local copy of CDNJS..." && \
  25. cd "$cdnjs_dir" && \
  26. git pull upstream master && \
  27. \
  28. echo "Copying over our changes..." && \
  29. cd "$proj_dir" && \
  30. cp -r -f dist/cdnjs/* "$cdnjs_dir/ajax/libs/fullcalendar/" && \
  31. \
  32. echo "Running CDNJS's tests..." && \
  33. cd "$cdnjs_dir" && \
  34. npm test && \
  35. \
  36. echo "Building commit..." && \
  37. git add "ajax/libs/fullcalendar/" && \
  38. git commit -e -m "fullcalendar v$version" && \
  39. echo && \
  40. echo 'DONE. It is now up to you to run `'"cd $cdnjs_dir && git push origin master"'` and submit the PR to CDNJS.' && \
  41. echo