mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix beta->latest->beta upgrade loop (#6189)
This commit is contained in:
1 parent
b428518857
commit
a784ca70b1
8 files changed
+81
-39
No files matched your search
+2
-13
@@ -3,23 +3,12 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import appSemanticVersionInjectable from "../../vars/app-semantic-version.injectable";
|
||||
import type { UpdateChannelId } from "../update-channels";
|
||||
import releaseChannelInjectable from "../../vars/release-channel.injectable";
|
||||
import { updateChannels } from "../update-channels";
|
||||
|
||||
const defaultUpdateChannelInjectable = getInjectable({
|
||||
id: "default-update-channel",
|
||||
|
||||
instantiate: (di) => {
|
||||
const appSemanticVersion = di.inject(appSemanticVersionInjectable);
|
||||
const currentReleaseChannel = appSemanticVersion.prerelease[0]?.toString();
|
||||
|
||||
if (currentReleaseChannel in updateChannels) {
|
||||
return updateChannels[currentReleaseChannel as UpdateChannelId];
|
||||
}
|
||||
|
||||
return updateChannels.latest;
|
||||
},
|
||||
instantiate: (di) => updateChannels[di.inject(releaseChannelInjectable)],
|
||||
});
|
||||
|
||||
export default defaultUpdateChannelInjectable;
|
||||
@@ -24,7 +24,7 @@ const alphaChannel: UpdateChannel = {
|
||||
moreStableUpdateChannel: betaChannel,
|
||||
};
|
||||
|
||||
export const updateChannels: Record<UpdateChannelId, UpdateChannel> = {
|
||||
export const updateChannels = {
|
||||
latest: latestChannel,
|
||||
beta: betaChannel,
|
||||
alpha: alphaChannel,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 { UpdateChannelId } from "../application-update/update-channels";
|
||||
import appSemanticVersionInjectable from "./app-semantic-version.injectable";
|
||||
|
||||
const releaseChannelInjectable = getInjectable({
|
||||
id: "release-channel",
|
||||
instantiate: (di): UpdateChannelId => {
|
||||
const appSemanticVersion = di.inject(appSemanticVersionInjectable);
|
||||
const currentReleaseChannel = appSemanticVersion.prerelease[0];
|
||||
|
||||
switch (currentReleaseChannel) {
|
||||
case "latest":
|
||||
case "beta":
|
||||
case "alpha":
|
||||
return currentReleaseChannel;
|
||||
default:
|
||||
return "latest";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export default releaseChannelInjectable;
|
||||
Reference in new issue
Block a user