mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Fix build of open-lens
- Remove need for using relative paths during build Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
6167ad2c25
commit
91354eae01
40 files changed
+284
-160
No files matched your search
@@ -0,0 +1,67 @@
|
||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||
import { runInAction } from "mobx";
|
||||
import {
|
||||
mainExtensionApi as Main,
|
||||
commonExtensionApi as Common,
|
||||
registerLensCore,
|
||||
} from "@k8slens/core/main";
|
||||
import { createContainer } from "@ogre-tools/injectable";
|
||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { registerFeature } from "@k8slens/feature-core";
|
||||
import { applicationFeature, startApplicationInjectionToken } from '@k8slens/application'
|
||||
import { applicationFeatureForElectronMain } from '@k8slens/application-for-electron-main'
|
||||
import { messagingFeatureForMain } from "@k8slens/messaging-for-main";
|
||||
import { loggerFeature } from "@k8slens/logger";
|
||||
|
||||
const environment = "main";
|
||||
|
||||
const di = createContainer(environment, {
|
||||
detectCycles: false,
|
||||
});
|
||||
|
||||
registerMobX(di);
|
||||
|
||||
runInAction(() => {
|
||||
registerLensCore(di, environment);
|
||||
|
||||
registerFeature(di,
|
||||
loggerFeature,
|
||||
);
|
||||
|
||||
registerFeature(di,
|
||||
applicationFeature,
|
||||
applicationFeatureForElectronMain,
|
||||
messagingFeatureForMain,
|
||||
);
|
||||
|
||||
try {
|
||||
autoRegister({
|
||||
di,
|
||||
targetModule: module,
|
||||
getRequireContexts: () => [
|
||||
require.context("./", true, CONTEXT_MATCHER_FOR_NON_FEATURES),
|
||||
require.context("../common", true, CONTEXT_MATCHER_FOR_NON_FEATURES),
|
||||
],
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
const startApplication = di.inject(startApplicationInjectionToken);
|
||||
|
||||
startApplication().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
})
|
||||
|
||||
export {
|
||||
Mobx,
|
||||
Pty,
|
||||
} from "@k8slens/core/main";
|
||||
|
||||
export const LensExtensions = {
|
||||
Main,
|
||||
Common,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { nodeEnvInjectionToken } from "@k8slens/core/main";
|
||||
|
||||
export const nodeEnvInjectable = getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => process.env.NODE_ENV || "development",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
});
|
||||
Reference in new issue
Block a user