Last active
March 27, 2021 21:25
-
-
Save dmtrKovalenko/e6be47ca2861a0ef8fe6136a6660afa6 to your computer and use it in GitHub Desktop.
Bash script migrating reasonml+bucklescript project < 8 version to rescript syntax
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
# make sure to update this glob for your poject | |
for file in ./**/src/**/*.{re,rei}; do | |
[ -f "$file" ] || break | |
FILENAME=$(basename -- "$file") | |
BASENAME=${FILENAME%%.*} | |
DIRNAME=$(dirname $file) | |
echo "$file" | |
if [ ${file: -3} == ".re" ]; then | |
npx bsc -format $file > "${DIRNAME}/${BASENAME}.res" | |
elif [ ${file: -4} == ".rei" ]; then | |
npx bsc -format $file > "${DIRNAME}/${BASENAME}.resi" | |
fi | |
rm $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment