transform.sh 647 B

12345678910111213141516
  1. # run tranformer
  2. npx jscodeshift \
  3. -t transform/o-error/transform.js \
  4. --ignore-pattern=frontend/js/libraries.js \
  5. --ignore-pattern=frontend/js/vendor \
  6. --ignore-pattern=**/*Controller*js \
  7. $1
  8. # replace blank lines in staged changed with token
  9. git diff --ignore-all-space --ignore-blank-lines | sed 's/^\+$/\+REMOVE_ME_IM_A_BLANK_LINE/g' | git apply --reject --cached --ignore-space-change
  10. # stage changes with token instead of blank line
  11. git checkout .
  12. git add -A
  13. # delete line containing token in staged files
  14. git diff --cached --name-only | xargs sed -i '/^REMOVE_ME_IM_A_BLANK_LINE$/d'
  15. # fix format on modified files
  16. make format_fix