decaffeinate.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env bash
  2. set -ex
  3. # Check .eslintrc and .prettierc are present
  4. npm install --save-dev eslint eslint-config-prettier eslint-config-standard \
  5. eslint-plugin-chai-expect eslint-plugin-chai-friendly eslint-plugin-import \
  6. eslint-plugin-mocha eslint-plugin-node eslint-plugin-prettier \
  7. eslint-plugin-promise eslint-plugin-standard prettier-eslint-cli
  8. git add .
  9. git commit -m "Decaffeinate: add eslint and prettier rc files"
  10. echo "------------------------"
  11. echo "----------APP-----------"
  12. echo "------------------------"
  13. # bulk-decaffeinate will commit for you
  14. npx bulk-decaffeinate convert --dir app/coffee
  15. npx bulk-decaffeinate clean
  16. git mv app/coffee app/js
  17. git commit -m "Rename app/coffee dir to app/js"
  18. npx prettier-eslint 'app/js/**/*.js' --write
  19. git add .
  20. git commit -m "Prettier: convert app/js decaffeinated files to Prettier format"
  21. echo "-------------------------"
  22. echo "--------UNIT TESTS-------"
  23. echo "-------------------------"
  24. npx bulk-decaffeinate convert --dir test/unit/coffee
  25. npx bulk-decaffeinate clean
  26. git mv test/unit/coffee test/unit/js
  27. git commit -m "Rename test/unit/coffee to test/unit/js"
  28. npx prettier-eslint 'test/unit/js/**/*.js' --write
  29. git add .
  30. git commit -m "Prettier: convert test/unit decaffeinated files to Prettier format"
  31. echo "-------------------------"
  32. echo "-------STRESS TESTS------"
  33. echo "-------------------------"
  34. npx bulk-decaffeinate convert --dir test/stress/coffee
  35. npx bulk-decaffeinate clean
  36. git mv test/stress/coffee test/stress/js
  37. git commit -m "Rename test/stress/coffee to test/stress/js"
  38. npx prettier-eslint 'test/stress/js/**/*.js' --write
  39. git add .
  40. git commit -m "Prettier: convert test/stress decaffeinated files to Prettier format"
  41. echo "--------------------------"
  42. echo "-----INDIVIDUAL FILES-----"
  43. echo "--------------------------"
  44. rm -f app.js config/settings.defaults.js
  45. git mv app.coffee app.js
  46. git mv config/settings.defaults.coffee config/settings.defaults.js
  47. git commit -m "Rename individual coffee files to js files"
  48. decaffeinate app.js
  49. decaffeinate config/settings.defaults.js
  50. git add .
  51. git commit -m "Decaffeinate: convert individual files to js"
  52. npx prettier-eslint 'app.js' 'config/settings.defaults.js' --write
  53. git add .
  54. git commit -m "Prettier: convert individual decaffeinated files to Prettier format"
  55. echo "done."