From 1d863f352a3c379a8e8a16d8891dfb65fb641450 Mon Sep 17 00:00:00 2001 From: Dillon Raphael Date: Thu, 28 Jul 2022 10:16:19 -0400 Subject: [PATCH] Fix APP_ENV not being set before running loadEnvConfig (#3629) * rearanges the order of setting --env before loading envConfig --- .changeset/fuzzy-bees-warn.md | 5 +++++ packages/blitz/src/cli/index.ts | 7 +++---- pnpm-lock.yaml | 33 +++++++++++++++------------------ 3 files changed, 23 insertions(+), 22 deletions(-) create mode 100644 .changeset/fuzzy-bees-warn.md diff --git a/.changeset/fuzzy-bees-warn.md b/.changeset/fuzzy-bees-warn.md new file mode 100644 index 0000000000..b21b77e329 --- /dev/null +++ b/.changeset/fuzzy-bees-warn.md @@ -0,0 +1,5 @@ +--- +"blitz": patch +--- + +Fix APP_ENV not being set before loading env config diff --git a/packages/blitz/src/cli/index.ts b/packages/blitz/src/cli/index.ts index 501b3e3a69..f8978cf932 100644 --- a/packages/blitz/src/cli/index.ts +++ b/packages/blitz/src/cli/index.ts @@ -120,6 +120,9 @@ async function printEnvInfo() { } async function main() { + if (args["--env"]) { + process.env.APP_ENV = args["--env"] + } loadEnvConfig(process.cwd(), undefined, {error: console.error, info: console.info}) // Version is inlined into the file using taskr build pipeline @@ -127,10 +130,6 @@ async function main() { await printEnvInfo() } - if (args["--env"]) { - process.env.APP_ENV = args["--env"] - } - if (args["--help"]) { forwardedArgs.push("--help") } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7b745d4af8..2b8c833b23 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: "@types/preview-email": 2.0.1 "@types/react": 18.0.1 "@typescript-eslint/eslint-plugin": 5.9.1 - blitz: workspace:2.0.0-alpha.58 + blitz: workspace:2.0.0-alpha.59 eslint: 7.32.0 eslint-config-next: 12.2.0 eslint-config-prettier: 8.5.0 @@ -475,8 +475,8 @@ importers: packages/blitz: specifiers: - "@blitzjs/config": workspace:2.0.0-alpha.58 - "@blitzjs/generator": 2.0.0-alpha.58 + "@blitzjs/config": workspace:2.0.0-alpha.59 + "@blitzjs/generator": 2.0.0-alpha.59 "@types/cookie": 0.4.1 "@types/cross-spawn": 6.0.2 "@types/debug": 4.1.7 @@ -584,7 +584,7 @@ importers: packages/blitz-auth: specifiers: - "@blitzjs/config": workspace:2.0.0-alpha.58 + "@blitzjs/config": workspace:2.0.0-alpha.59 "@testing-library/react": 13.0.0 "@testing-library/react-hooks": 7.0.2 "@types/b64-lite": 1.3.0 @@ -598,7 +598,7 @@ importers: "@types/secure-password": 3.1.1 b64-lite: 1.4.0 bad-behavior: 1.0.1 - blitz: 2.0.0-alpha.58 + blitz: 2.0.0-alpha.59 cookie: 0.4.1 cookie-session: 2.0.0 debug: 4.3.3 @@ -649,8 +649,8 @@ importers: packages/blitz-next: specifiers: - "@blitzjs/config": workspace:2.0.0-alpha.58 - "@blitzjs/rpc": 2.0.0-alpha.58 + "@blitzjs/config": workspace:2.0.0-alpha.59 + "@blitzjs/rpc": 2.0.0-alpha.59 "@testing-library/dom": 8.13.0 "@testing-library/jest-dom": 5.16.3 "@testing-library/react": 13.0.0 @@ -661,7 +661,7 @@ importers: "@types/react": 18.0.1 "@types/react-dom": 17.0.14 "@types/testing-library__react-hooks": 4.0.0 - blitz: 2.0.0-alpha.58 + blitz: 2.0.0-alpha.59 cross-spawn: 7.0.3 debug: 4.3.3 find-up: 4.1.0 @@ -710,14 +710,14 @@ importers: packages/blitz-rpc: specifiers: - "@blitzjs/auth": 2.0.0-alpha.58 - "@blitzjs/config": workspace:2.0.0-alpha.58 + "@blitzjs/auth": 2.0.0-alpha.59 + "@blitzjs/config": workspace:2.0.0-alpha.59 "@types/debug": 4.1.7 "@types/react": 18.0.1 "@types/react-dom": 17.0.14 b64-lite: 1.4.0 bad-behavior: 1.0.1 - blitz: 2.0.0-alpha.58 + blitz: 2.0.0-alpha.59 chalk: ^4.1.0 debug: 4.3.3 next: 12.2.0 @@ -759,12 +759,12 @@ importers: "@babel/plugin-syntax-typescript": 7.17.12 "@babel/preset-env": 7.12.10 "@blitzjs/config": workspace:* - "@blitzjs/generator": 2.0.0-alpha.58 + "@blitzjs/generator": 2.0.0-alpha.59 "@types/jscodeshift": 0.11.2 "@types/node": 17.0.16 arg: 5.0.1 ast-types: 0.14.2 - blitz: 2.0.0-alpha.58 + blitz: 2.0.0-alpha.59 chalk: ^4.1.0 cross-spawn: 7.0.3 debug: 4.3.3 @@ -819,7 +819,7 @@ importers: "@babel/plugin-transform-typescript": 7.12.1 "@babel/preset-env": 7.12.10 "@babel/types": 7.12.10 - "@blitzjs/config": 2.0.0-alpha.58 + "@blitzjs/config": 2.0.0-alpha.59 "@juanm04/cpx": 2.0.1 "@mrleebo/prisma-ast": 0.2.6 "@types/babel__core": 7.1.19 @@ -910,7 +910,7 @@ importers: packages/pkg-template: specifiers: - "@blitzjs/config": 2.0.0-alpha.58 + "@blitzjs/config": 2.0.0-alpha.59 "@types/react": 18.0.1 "@types/react-dom": 17.0.14 "@typescript-eslint/eslint-plugin": 5.9.1 @@ -4844,7 +4844,6 @@ packages: typescript: 4.6.3 transitivePeerDependencies: - supports-color - dev: false /@typescript-eslint/experimental-utils/5.28.0_hrkuebk64jiu2ut2d2sm4oylnu: resolution: @@ -8442,7 +8441,6 @@ packages: transitivePeerDependencies: - eslint-import-resolver-webpack - supports-color - dev: false /eslint-config-next/12.2.3_hrkuebk64jiu2ut2d2sm4oylnu: resolution: @@ -8480,7 +8478,6 @@ packages: hasBin: true peerDependencies: eslint: ">=7.0.0" - dev: false /eslint-config-prettier/8.5.0_eslint@7.32.0: resolution: