Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix build not working with different config environments

Mike McGannc040c9909e3b
diff --git a/package.json b/package.json
index 69fc5d1d7..89aee7988 100644
--- a/package.json
+++ b/package.json
@@ -28,9 +28,9 @@
"scripts": {
"analyze": "cross-env NODE_ENV=analyze webpack",
"browserstack": "node e2e/browserstack.js -c e2e/browserstack.conf.js -e browserstack ",
- "build": "run-s clean \"getcapabilities -- {1}\" \"build:config -- {1}\" build:dev --",
+ "build": "run-s clean getcapabilities build:config build:dev",
"build:dev": "webpack",
- "build:config": "bash -c 'tasks/buildOptions.sh ${1}' 0 && node ./tasks/config.js",
+ "build:config": "bash -c 'tasks/buildOptions.sh' && node ./tasks/config.js",
"build:prod": "cross-env NODE_ENV=production webpack",
"build:tests": "cross-env NODE_ENV=testing webpack",
"clean": "node ./tasks/clean.js",
@@ -40,7 +40,7 @@
"e2e": "run-s --continue-on-error --silent e2e:*",
"e2e:chrome": "nightwatch -e chrome",
"e2e:firefox": "nightwatch -e firefox --skiptags wip",
- "getcapabilities": "bash -c 'FETCH_GC=1 tasks/buildOptions.sh ${1}' 0",
+ "getcapabilities": "bash -c 'FETCH_GC=1 tasks/buildOptions.sh'",
"linkcheck": "node ./tasks/linkcheck",
"lint": "run-s lint:*",
"lint:css": "stylelint ./web/css/**/*.css",
diff --git a/tasks/buildOptions.sh b/tasks/buildOptions.sh
index 0c97bf030..197cdd9be 100755
--- a/tasks/buildOptions.sh
+++ b/tasks/buildOptions.sh
@@ -25,9 +25,8 @@ die() {
[ -d "$SRC_DIR" ] || die "Options directory does not exist"
-# Set $OPT_SUBDIR to the first argument passed into this script
-# Or "release" if there is no argument passed
-OPT_SUBDIR="${1-release}"
+# Set $OPT_SUBDIR to the value of CONFIG_ENV or "release"
+OPT_SUBDIR="${CONFIG_ENV-release}"
# Activate virtual Python environment
PATH=.python/bin:.python/Scripts:${PATH}
diff --git a/tasks/upload.js b/tasks/upload.js
index 51260e2a8..553285281 100755
--- a/tasks/upload.js
+++ b/tasks/upload.js
@@ -132,12 +132,12 @@ async function upload() {
};
if (!argv.dist) {
- shell.exec('npm install');
let cmd = 'npm run build';
+ let options = {};
if (argv.env) {
- cmd = cmd + ' -- ' + argv.env;
+ options.env = { ...process.env, CONFIG_ENV: argv.env };
}
- shell.exec(cmd);
+ shell.exec(cmd, options);
shell.exec('node ./tasks/dist.js');
}