Skip to content

Instantly share code, notes, and snippets.

@dmtrKovalenko
Last active March 27, 2021 21:25
Show Gist options
  • Save dmtrKovalenko/e6be47ca2861a0ef8fe6136a6660afa6 to your computer and use it in GitHub Desktop.
Save dmtrKovalenko/e6be47ca2861a0ef8fe6136a6660afa6 to your computer and use it in GitHub Desktop.
Bash script migrating reasonml+bucklescript project < 8 version to rescript syntax
# 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