mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Deprecate vars in favor of injectables
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
f1e0fd081d
commit
5c31203e50
@ -9,21 +9,43 @@ import { SemVer } from "semver";
|
||||
import packageInfo from "../../package.json";
|
||||
import { lazyInitialized } from "./utils/lazy-initialized";
|
||||
|
||||
/**
|
||||
* @deprecated Switch to using isMacInjectable
|
||||
*/
|
||||
export const isMac = process.platform === "darwin";
|
||||
|
||||
/**
|
||||
* @deprecated Switch to using isWindowsInjectable
|
||||
*/
|
||||
export const isWindows = process.platform === "win32";
|
||||
|
||||
/**
|
||||
* @deprecated Switch to using isLinuxInjectable
|
||||
*/
|
||||
export const isLinux = process.platform === "linux";
|
||||
|
||||
export const isDebugging = ["true", "1", "yes", "y", "on"].includes((process.env.DEBUG ?? "").toLowerCase());
|
||||
export const isSnap = !!process.env.SNAP;
|
||||
export const isProduction = process.env.NODE_ENV === "production";
|
||||
export const isTestEnv = !!process.env.JEST_WORKER_ID;
|
||||
|
||||
/**
|
||||
* @deprecated Switch to using isDevelopmentInjectable
|
||||
*/
|
||||
export const isDevelopment = !isTestEnv && !isProduction;
|
||||
|
||||
export const isPublishConfigured = Object.keys(packageInfo.build).includes("publish");
|
||||
|
||||
export const integrationTestingArg = "--integration-testing";
|
||||
export const isIntegrationTesting = process.argv.includes(integrationTestingArg);
|
||||
|
||||
export const productName = packageInfo.productName;
|
||||
|
||||
/**
|
||||
* @deprecated Switch to using appNameInjectable
|
||||
*/
|
||||
export const appName = `${packageInfo.productName}${isDevelopment ? "Dev" : ""}`;
|
||||
|
||||
export const publicPath = "/build/" as string;
|
||||
export const defaultTheme = "lens-dark" as string;
|
||||
export const defaultFontSize = 12;
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { isDevelopment } from "../vars";
|
||||
import { isProduction, isTestEnv } from "../vars";
|
||||
|
||||
const isDevelopmentInjectable = getInjectable({
|
||||
id: "is-development",
|
||||
instantiate: () => isDevelopment,
|
||||
instantiate: () => !isTestEnv && !isProduction,
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default isDevelopmentInjectable;
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { isLinux } from "../vars";
|
||||
|
||||
const isLinuxInjectable = getInjectable({
|
||||
id: "is-linux",
|
||||
instantiate: () => isLinux,
|
||||
instantiate: () => process.platform === "linux",
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { isMac } from "../vars";
|
||||
|
||||
const isMacInjectable = getInjectable({
|
||||
id: "is-mac",
|
||||
instantiate: () => isMac,
|
||||
instantiate: () => process.platform === "darwin",
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { isWindows } from "../vars";
|
||||
|
||||
const isWindowsInjectable = getInjectable({
|
||||
id: "is-windows",
|
||||
instantiate: () => isWindows,
|
||||
instantiate: () => process.platform === "win32",
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user