File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,19 @@ CACHE_DIR=$2
15
15
ENV_DIR=$3
16
16
BP_DIR=` cd $( dirname $0 ) ; cd ..; pwd`
17
17
18
+ export_env_dir () {
19
+ local env_dir=$1
20
+ local whitelist_regex=${2:- ' ' }
21
+ local blacklist_regex=${3:- ' ^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH|IFS)$' }
22
+ if [ -d " $env_dir " ]; then
23
+ for e in $( ls $env_dir ) ; do
24
+ echo " $e " | grep -E " $whitelist_regex " | grep -qvE " $blacklist_regex " &&
25
+ export " $e =$( cat $env_dir /$e ) "
26
+ :
27
+ done
28
+ fi
29
+ }
30
+
18
31
cd $BUILD_DIR
19
32
20
33
# Set the web root to the build/ directory
26
39
echo ' { "root": "build/" }' > static.json
27
40
fi
28
41
42
+ # Support custom `REACT_APP_*` env vars during build.
43
+ # https://github.com/facebookincubator/create-react-app/blob/v0.2.3/template/README.md#adding-custom-environment-variables
44
+ export_env_dir " $ENV_DIR " ' ^REACT_APP_'
45
+
29
46
# Build the javascript bundle
30
47
npm run build
You can’t perform that action at this time.
0 commit comments