Thomas E Lackey
042b413598
* Support the case where webpack config is already present next.config.js * Update scripts for experimental-compile/experimental-generate
30 lines
741 B
Bash
Executable File
30 lines
741 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
set -x
|
|
fi
|
|
|
|
WORK_DIR="${1:-./}"
|
|
TMPF=$(mktemp)
|
|
|
|
cd "$WORK_DIR" || exit 1
|
|
|
|
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_]+' >> $TMPF
|
|
done
|
|
done
|
|
|
|
NEXT_CONF="next.config.js next.config.dist"
|
|
for f in $NEXT_CONF; do
|
|
cat "$f" | tr -s '[:blank:]' '\n' | tr -s '[{},()]' '\n' | egrep -o 'process.env.[A-Za-z0-9_]+' >> $TMPF
|
|
done
|
|
|
|
cat $TMPF | sort -u | jq --raw-input . | jq --slurp .
|
|
rm -f $TMPF
|