Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit a162bdc

Browse files
authored
feat: add feature flags logic (#765)
1 parent 7335e6b commit a162bdc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

run-build-functions.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ mkdir -p $NETLIFY_CACHE_DIR/.cargo
7272
: ${NPM_FLAGS=""}
7373
: ${BUNDLER_FLAGS=""}
7474

75+
# Feature flags are a comma-separated list.
76+
# The following logic relies on the fact that feature flags cannot currently
77+
# have escaped commas in their value. Otherwise, parsing the list as an array,
78+
# e.g. using `IFS="," read -ra <<<"$1"` would be needed.
79+
has_feature_flag() {
80+
if [[ "${1}," == *"${2},"* ]]; then
81+
return 0
82+
else
83+
return 1
84+
fi
85+
}
86+
7587
install_deps() {
7688
[ -f $1 ] || return 0
7789
[ -f $3 ] || return 0
@@ -234,6 +246,7 @@ install_dependencies() {
234246
local defaultYarnVersion=$3
235247
local installGoVersion=$4
236248
local defaultPythonVersion=$5
249+
local featureFlags="$6"
237250

238251
# Python Version
239252
if [ -f runtime.txt ]

0 commit comments

Comments
 (0)