From cf64a8ddde05e7e73cad37d271f5d6dfa61c5d7f Mon Sep 17 00:00:00 2001 From: stew-ro <60453211+stew-ro@users.noreply.github.com> Date: Fri, 11 Sep 2020 14:24:37 -0700 Subject: [PATCH] fix: support multiple env files (#574) --- .env.release | 5 +++++ package.json | 3 ++- yarn.lock | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .env.release diff --git a/.env.release b/.env.release new file mode 100644 index 000000000..c91b04eb8 --- /dev/null +++ b/.env.release @@ -0,0 +1,5 @@ +# react-scripts build use this to generate the right path for assets +# relative to index.html +# without it, you'll see error like this +# Failed to load resource: net::ERR_FILE_NOT_FOUND /favicon.ico:1 +PUBLIC_URL= \ No newline at end of file diff --git a/package.json b/package.json index 55bdb401e..7f26c6d9e 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "electron:start:dev": "yarn electron-start", "electron:start:prod": "yarn webpack:prod && yarn electron-start", "electron-start": "node src/electron/start", - "release": "yarn build && yarn webpack:prod && yarn electron-builder", + "release": "env-cmd -f .env.release \"yarn build && yarn webpack:prod && yarn electron-builder\"", "tslint": "./node_modules/.bin/tslint 'src/**/*.ts*'", "tslintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix" }, @@ -100,6 +100,7 @@ "acorn": "^7.1.1", "electron": "8.3.0", "electron-builder": "^22.6.1", + "env-cmd": "^10.1.0", "enzyme": "^3.10.0", "enzyme-adapter-react-16": "^1.15.1", "eslint-utils": "^1.4.3", diff --git a/yarn.lock b/yarn.lock index 27e0cb3a0..d108e1864 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3809,7 +3809,7 @@ commander@^2.11.0, commander@^2.12.1, commander@^2.15.1, commander@^2.19.0, comm resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.1.1: +commander@^4.0.0, commander@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== @@ -4088,6 +4088,15 @@ cross-spawn@^3.0.0: lru-cache "^4.0.1" which "^1.2.9" +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -4917,6 +4926,14 @@ entities@^2.0.0: resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== +env-cmd@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-10.1.0.tgz#c7f5d3b550c9519f137fdac4dd8fb6866a8c8c4b" + integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA== + dependencies: + commander "^4.0.0" + cross-spawn "^7.0.0" + env-paths@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43"