test-progressive-web-app/scripts/find-env.sh

19 lines
459 B
Bash
Executable File

#!/bin/bash
TMPF=`mktemp`
for d in $(find . -maxdepth 1 -type d | grep -v '\./\.' | grep '/' | cut -d'/' -f2); do
egrep "/$d[/$]?" .gitignore >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
continue
fi
for f in $(find $d -regex ".*.[tj]sx?$" -type f); do
cat $f | tr -s '[:blank:]' '\n' | tr -s '[{},()]' '\n' | egrep -o 'process.env.[A-Za-z0-9_]+' $f >> $TMPF
done
done
cat $TMPF | sort -u | jq --raw-input . | jq --slurp .
rm -f $TMPF