Clean up versioning and packageJson uses (#6196)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-09-15 17:20:58 -04:00
1 parent cfe35ded90
commit 67ac1692b2
116 files changed
+1154 -644

No files matched your search

+3 -16
View File
@@ -4,19 +4,16 @@
*/
import { app } from "electron";
import semver from "semver";
import { action, computed, observable, reaction, makeObservable, isObservableArray, isObservableSet, isObservableMap } from "mobx";
import { BaseStore } from "../base-store";
import migrations from "../../migrations/user-store";
import { getAppVersion } from "../utils/app-version";
import { kubeConfigDefaultPath } from "../kube-helpers";
import { appEventBus } from "../app-event-bus/event-bus";
import { getOrInsertSet, toggle, toJS, object } from "../../renderer/utils";
import { DESCRIPTORS } from "./preferences-helpers";
import type { UserPreferencesModel, StoreType } from "./preferences-helpers";
import logger from "../../main/logger";
import type { SelectedUpdateChannel } from "../application-update/selected-update-channel/selected-update-channel.injectable";
import type { UpdateChannelId } from "../application-update/update-channels";
import type { ReleaseChannel } from "../application-update/update-channels";
export interface UserStoreModel {
lastSeenAppVersion: string;
@@ -24,7 +21,7 @@ export interface UserStoreModel {
}
interface Dependencies {
selectedUpdateChannel: SelectedUpdateChannel;
readonly selectedUpdateChannel: SelectedUpdateChannel;
}
export class UserStore extends BaseStore<UserStoreModel> /* implements UserStoreFlatModel (when strict null is enabled) */ {
@@ -98,10 +95,6 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
*/
@observable syncKubeconfigEntries!: StoreType<typeof DESCRIPTORS["syncKubeconfigEntries"]>;
@computed get isNewVersion() {
return semver.gt(getAppVersion(), this.lastSeenAppVersion);
}
@computed get resolvedShell(): string | undefined {
return this.shell || process.env.SHELL || process.env.PTYSHELL;
}
@@ -151,12 +144,6 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
this.colorTheme = DESCRIPTORS.colorTheme.fromStore(undefined);
}
@action
saveLastSeenAppVersion() {
appEventBus.emit({ name: "app", action: "whats-new-seen" });
this.lastSeenAppVersion = getAppVersion();
}
@action
protected fromStore({ lastSeenAppVersion, preferences }: Partial<UserStoreModel> = {}) {
logger.debug("UserStore.fromStore()", { lastSeenAppVersion, preferences });
@@ -180,7 +167,7 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
// TODO: Switch to action-based saving instead saving stores by reaction
if (preferences?.updateChannel) {
this.dependencies.selectedUpdateChannel.setValue(preferences?.updateChannel as UpdateChannelId);
this.dependencies.selectedUpdateChannel.setValue(preferences?.updateChannel as ReleaseChannel);
}
}