How to automatically generate interface for all files


I know how to generate an interface for a single file and output it to stdout. But I haven’t found an easy and automated way to be able to do something like this in my scripts yarn generate:interfaces src or yarn generate:interfaces src/ and have it generate .rei files alongside every one of my .re files inside src. Is there a way to achieve this?


Not sure if this would help, but could you write a shell script that calls bsc as in ?


Here is the small script I’m using


rm -rf lib/bs/rei
mkdir -p lib/bs/rei

  FILENAME=`echo $(basename $1)  | cut -d'-' -f 1`
  echo "lib/bs/rei/$FILENAME.rei"

for i in $(find lib/bs/src -name '*.cmi');do
   bsc -bs-re-out "$(pwd)/$i" > "$(filepath $i)"