mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add missing global overrides
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
7cdcf67ccc
commit
b78d3d5034
@ -3,11 +3,15 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import platformInjectable from "./platform.injectable";
|
||||||
|
|
||||||
const normalizedPlatformInjectable = getInjectable({
|
const normalizedPlatformInjectable = getInjectable({
|
||||||
id: "normalized-platform",
|
id: "normalized-platform",
|
||||||
instantiate: () => {
|
|
||||||
switch (process.platform) {
|
instantiate: (di) => {
|
||||||
|
const platform = di.inject(platformInjectable);
|
||||||
|
|
||||||
|
switch (platform) {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
return "darwin";
|
return "darwin";
|
||||||
case "linux":
|
case "linux":
|
||||||
@ -15,10 +19,9 @@ const normalizedPlatformInjectable = getInjectable({
|
|||||||
case "win32":
|
case "win32":
|
||||||
return "windows";
|
return "windows";
|
||||||
default:
|
default:
|
||||||
throw new Error(`platform=${process.platform} is unsupported`);
|
throw new Error(`platform=${platform} is unsupported`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
causesSideEffects: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default normalizedPlatformInjectable;
|
export default normalizedPlatformInjectable;
|
||||||
|
|||||||
@ -85,6 +85,7 @@ import appVersionInjectable from "../common/get-configuration-file-model/app-ver
|
|||||||
import getRandomIdInjectable from "../common/utils/get-random-id.injectable";
|
import getRandomIdInjectable from "../common/utils/get-random-id.injectable";
|
||||||
import periodicalCheckForUpdatesInjectable from "./application-update/periodical-check-for-updates/periodical-check-for-updates.injectable";
|
import periodicalCheckForUpdatesInjectable from "./application-update/periodical-check-for-updates/periodical-check-for-updates.injectable";
|
||||||
import execFileInjectable from "../common/fs/exec-file.injectable";
|
import execFileInjectable from "../common/fs/exec-file.injectable";
|
||||||
|
import normalizedPlatformArchitectureInjectable from "../common/vars/normalized-platform-architecture.injectable";
|
||||||
|
|
||||||
export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) {
|
export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) {
|
||||||
const {
|
const {
|
||||||
@ -210,6 +211,7 @@ const overrideOperatingSystem = (di: DiContainer) => {
|
|||||||
di.override(platformInjectable, () => "darwin");
|
di.override(platformInjectable, () => "darwin");
|
||||||
di.override(getAbsolutePathInjectable, () => getAbsolutePathFake);
|
di.override(getAbsolutePathInjectable, () => getAbsolutePathFake);
|
||||||
di.override(joinPathsInjectable, () => joinPathsFake);
|
di.override(joinPathsInjectable, () => joinPathsFake);
|
||||||
|
di.override(normalizedPlatformArchitectureInjectable, () => "arm64");
|
||||||
};
|
};
|
||||||
|
|
||||||
const overrideElectronFeatures = (di: DiContainer) => {
|
const overrideElectronFeatures = (di: DiContainer) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user