1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

remove NODE_ENV from environmentVariablesInjectable

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2022-12-22 16:22:59 +02:00
parent f66050f1aa
commit 8667a47d44
3 changed files with 6 additions and 9 deletions

View File

@ -3,21 +3,16 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import nodeEnvInjectionToken from "../vars/node-env-injection-token";
const environmentVariablesInjectable = getInjectable({
id: "environment-variables",
instantiate: (di) => {
// IMPORTANT: The syntax needs to be exactly this in order to make environment variable values
// hard-coded at compile-time by Webpack.
const NODE_ENV = di.inject(nodeEnvInjectionToken);
instantiate: () => {
const JEST_WORKER_ID = process.env.JEST_WORKER_ID;
const CICD = process.env.CICD;
return {
// Compile-time environment variables
NODE_ENV,
JEST_WORKER_ID,
CICD,

View File

@ -3,13 +3,13 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import environmentVariablesInjectable from "../utils/environment-variables.injectable";
import nodeEnvInjectionToken from "./node-env-injection-token";
const isProductionInjectable = getInjectable({
id: "is-production",
instantiate: (di) => {
const { NODE_ENV: nodeEnv } = di.inject(environmentVariablesInjectable);
const nodeEnv = di.inject(nodeEnvInjectionToken);
return nodeEnv === "production";
},

View File

@ -3,6 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import nodeEnvInjectionToken from "../../../common/vars/node-env-injection-token";
import loggerInjectable from "../../../common/logger.injectable";
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
@ -11,11 +12,12 @@ const setupDeveloperToolsInDevelopmentEnvironmentInjectable = getInjectable({
instantiate: (di) => {
const logger = di.inject(loggerInjectable);
const nodeEnv = di.inject(nodeEnvInjectionToken);
return {
id: "setup-developer-tools-in-development-environment",
run: () => {
if (process.env.NODE_ENV !== "development") {
if (nodeEnv !== "development") {
return;
}