Last active
December 9, 2020 02:03
-
-
Save parkerziegler/2c0a6a7524ed8122c191cd56bad6e73a to your computer and use it in GitHub Desktop.
A Bash script to run an automated upgrade from Reason (bs-platform@<8) to ReScript (bs-platform@>=8).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function npm-do { (PATH=$(npm bin):$PATH; eval $@;) } | |
for file in src/*.re src/*.rei; do | |
[ -f "$file" ] || break | |
FILENAME=${file#src/} | |
BASENAME=${FILENAME%%.*} | |
cd src | |
if [ ${file: -3} == ".re" ]; then | |
npm-do bsc -format $FILENAME > "${BASENAME}.res" | |
elif [ ${file: -4} == ".rei" ]; then | |
npm-do bsc -format $FILENAME > "${BASENAME}.resi" | |
fi | |
rm $FILENAME | |
cd ../ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment