1
0
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:
Sebastian Malton 2022-09-19 10:52:48 -04:00
parent dad6dcacda
commit e385e8bbc1
3 changed files with 49 additions and 3 deletions

View File

@ -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];

View 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;

View 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;