From f3628460c1f47077da8dbb4b0eb654be8d1cf811 Mon Sep 17 00:00:00 2001 From: Stephen Jennings Date: Mon, 30 Dec 2019 17:18:02 -0800 Subject: [PATCH] use cross-env to set environment variables in scripts (#121) When running tests and builds on Windows, `VAR_NAME=value command` is not valid syntax for setting environment variables. cross-env takes care of setting variables properly before executing the command. --- package-lock.json | 52 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 5 +++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1def6c2..3a7fb99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4385,6 +4385,58 @@ "sha.js": "^2.4.8" } }, + "cross-env": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz", + "integrity": "sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", diff --git a/package.json b/package.json index 69b0220..d11fa7a 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "test": "jest --coverage", "test:watch": "jest --watch", "doc": "npm run doc:dev", - "doc:dev": "NODE_ENV=development parcel website/index.html --out-dir doc --no-cache", - "doc:build": "rimraf doc && NODE_ENV=production parcel build website/index.html --out-dir doc --public-url ./ --no-cache --no-source-maps" + "doc:dev": "cross-env NODE_ENV=development parcel website/index.html --out-dir doc --no-cache", + "doc:build": "rimraf doc && cross-env NODE_ENV=production parcel build website/index.html --out-dir doc --public-url ./ --no-cache --no-source-maps" }, "files": [ "index.d.ts", @@ -61,6 +61,7 @@ "bannerjs": "^1.0.5", "classnames": "^2.2.5", "colors-cli": "^1.0.26", + "cross-env": "^6.0.3", "eslint": "^4.19.1", "eslint-config-airbnb": "^16.1.0", "eslint-plugin-import": "^2.18.2",