mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Convert ReleaseChannel into an InitializableState
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
dad6dcacda
commit
e385e8bbc1
@ -2,13 +2,13 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { ReleaseChannel } from "../application-update/update-channels";
|
||||
import { createInitializableState } from "../initializable-state/create";
|
||||
import buildSemanticVersionInjectable from "./build-semantic-version.injectable";
|
||||
|
||||
const releaseChannelInjectable = getInjectable({
|
||||
const releaseChannelInjectable = createInitializableState({
|
||||
id: "release-channel",
|
||||
instantiate: (di): ReleaseChannel => {
|
||||
init: (di): ReleaseChannel => {
|
||||
const buildSemanticVersion = di.inject(buildSemanticVersionInjectable);
|
||||
const currentReleaseChannel = buildSemanticVersion.get().prerelease[0];
|
||||
|
||||
|
||||
23
src/main/vars/release-channel/init.injectable.ts
Normal file
23
src/main/vars/release-channel/init.injectable.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import releaseChannelInjectable from "../../../common/vars/release-channel.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import initSemanticBuildVersionInjectable from "../semantic-build-version/init.injectable";
|
||||
|
||||
const initReleaseChannelInjectable = getInjectable({
|
||||
id: "init-release-channel",
|
||||
instantiate: (di) => {
|
||||
const releaseChannel = di.inject(releaseChannelInjectable);
|
||||
|
||||
return {
|
||||
run: () => releaseChannel.init(),
|
||||
runAfter: di.inject(initSemanticBuildVersionInjectable),
|
||||
};
|
||||
},
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
export default initReleaseChannelInjectable;
|
||||
23
src/renderer/vars/release-channel/init.injectable.ts
Normal file
23
src/renderer/vars/release-channel/init.injectable.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import releaseChannelInjectable from "../../../common/vars/release-channel.injectable";
|
||||
import { beforeFrameStartsInjectionToken } from "../../before-frame-starts/before-frame-starts-injection-token";
|
||||
import initSemanticBuildVersionInjectable from "../semantic-build-version/init.injectable";
|
||||
|
||||
const initReleaseChannelInjectable = getInjectable({
|
||||
id: "init-release-channel",
|
||||
instantiate: (di) => {
|
||||
const releaseChannel = di.inject(releaseChannelInjectable);
|
||||
|
||||
return {
|
||||
run: () => releaseChannel.init(),
|
||||
runAfter: di.inject(initSemanticBuildVersionInjectable),
|
||||
};
|
||||
},
|
||||
injectionToken: beforeFrameStartsInjectionToken,
|
||||
});
|
||||
|
||||
export default initReleaseChannelInjectable;
|
||||
Loading…
Reference in New Issue
Block a user