transform.sh 608 B

123456789101112131415
  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. $1
  7. # replace blank lines in staged changed with token
  8. git diff --ignore-all-space --ignore-blank-lines | sed 's/^\+$/\+REMOVE_ME_IM_A_BLANK_LINE/g' | git apply --reject --cached --ignore-space-change
  9. # stage changes with token instead of blank line
  10. git checkout .
  11. git add -A
  12. # delete line containing token in staged files
  13. git diff --cached --name-only | xargs sed -i '/^REMOVE_ME_IM_A_BLANK_LINE$/d'
  14. # fix format on modified files
  15. make format_fix