@@ -148,6 +148,7 @@ import * as DownloadUtils from '../utils/DownloadUtils';
import { getStore } from '../providers/generic/store/StoreProvider';
import { State } from '../store';
import ManagerActivityBar from '../components/navigation/ManagerActivityBar.vue';
+import ThunderstoreCombo from 'src/model/ThunderstoreCombo';
const store = getStore
();
diff --git a/src/pages/GameSelectionScreen.vue b/src/pages/GameSelectionScreen.vue
index d7bc13b95..56a1e721d 100644
--- a/src/pages/GameSelectionScreen.vue
+++ b/src/pages/GameSelectionScreen.vue
@@ -53,11 +53,11 @@
+ :disabled="selectedGame === null || runningMigration" @click="selectGame(selectedGame! as Game)">Select {{ activeTab.toLowerCase() }}
+ :disabled="selectedGame === null || runningMigration" @click="selectDefaultGame(selectedGame! as Game)">Set as default
diff --git a/src/pages/Manager.vue b/src/pages/Manager.vue
index 6fa87189f..20a11012e 100644
--- a/src/pages/Manager.vue
+++ b/src/pages/Manager.vue
@@ -220,11 +220,11 @@ function changeGameInstallDirectory() {
filters: (activeGame.value.exeName.map(value => {
const nameSplit = value.split(".");
return [{
- name: nameSplit[0],
- extensions: [nameSplit[1]]
+ name: nameSplit[0]!,
+ extensions: [nameSplit[1]!]
}]
}).reduce((previousValue, currentValue) => {
- previousValue[0].extensions = [...previousValue[0].extensions, ...currentValue[0].extensions];
+ previousValue[0]!.extensions = [...previousValue[0]!.extensions, ...currentValue[0]!.extensions];
return previousValue;
})),
defaultPath: ror2Directory,
@@ -232,9 +232,9 @@ function changeGameInstallDirectory() {
}).then(async files => {
if (files.length === 1) {
try {
- const containsGameExecutable = activeGame.value.exeName.find(exeName => path.basename(files[0]).toLowerCase() === exeName.toLowerCase()) !== undefined
+ const containsGameExecutable = activeGame.value.exeName.find(exeName => path.basename(files[0]!).toLowerCase() === exeName.toLowerCase()) !== undefined
if (containsGameExecutable) {
- await settings.value.setGameDirectory(path.dirname(await FsProvider.instance.realpath(files[0])));
+ await settings.value.setGameDirectory(path.dirname(await FsProvider.instance.realpath(files[0]!)));
} else {
showRor2IncorrectDirectoryModal.value = true;
}
@@ -256,9 +256,9 @@ function changeGameInstallDirectoryGamePass() {
}).then(async files => {
if (files.length === 1) {
try {
- const containsGameExecutable = (path.basename(files[0]).toLowerCase() === "gamelaunchhelper.exe");
+ const containsGameExecutable = (path.basename(files[0]!).toLowerCase() === "gamelaunchhelper.exe");
if (containsGameExecutable) {
- await settings.value.setGameDirectory(path.dirname(await FsProvider.instance.realpath(files[0])));
+ await settings.value.setGameDirectory(path.dirname(await FsProvider.instance.realpath(files[0]!)));
} else {
throw new Error("The selected executable is not gamelaunchhelper.exe");
}
@@ -309,8 +309,8 @@ function changeSteamDirectory() {
}).then(async files => {
if (files.length === 1) {
try {
- if (await checkIfSteamExecutableIsValid(files[0])) {
- await settings.value.setSteamDirectory(path.dirname(await FsProvider.instance.realpath(files[0])));
+ if (await checkIfSteamExecutableIsValid(files[0]!)) {
+ await settings.value.setSteamDirectory(path.dirname(await FsProvider.instance.realpath(files[0]!)));
} else {
showSteamIncorrectDirectoryModal.value = true;
}
diff --git a/src/pages/Splash.vue b/src/pages/Splash.vue
index a3d16f166..3a9638f74 100644
--- a/src/pages/Splash.vue
+++ b/src/pages/Splash.vue
@@ -135,6 +135,7 @@ import Buffer from '../providers/node/buffer/buffer';
import ProtocolProvider from '../providers/generic/protocol/ProtocolProvider';
import ManagerSettings from '../r2mm/manager/ManagerSettings';
import { LaunchType } from '../model/real_enums/launch/LaunchType';
+import { UpdateRequestItemBody } from '../store/modules/SplashModule';
const store = getStore();
const router = useRouter();
@@ -144,7 +145,7 @@ const {
} = useSplashComposable();
const heroTitle = ref('Starting r2modman');
-const heroType = ref('primary');
+const heroType = ref<'primary' | 'warning'>('primary');
const view = ref('main');
const splashText = computed(() => store.state.splash.splashText);
@@ -191,7 +192,6 @@ async function ensureWrapperInGameFolder(wrapperName: WrapperScript) {
const wrapperFileResult = await fetch(ProtocolProvider.getPublicAssetUrl(`/${wrapperName}`)).then(res => res.arrayBuffer());
const wrapperFileContent = Buffer.from(wrapperFileResult);
await FsProvider.instance.writeFile(path.join(PathResolver.MOD_ROOT, wrapperName), wrapperFileContent);
- await FsProvider.instance.writeFile(path.join(PathResolver.MOD_ROOT, wrapperName), wrapperFileContent);
}
await FsProvider.instance.chmod(path.join(PathResolver.MOD_ROOT, wrapperName), 0o755);
}
diff --git a/src/providers/node/path/path.ts b/src/providers/node/path/path.ts
index 54043049c..698ae6f82 100644
--- a/src/providers/node/path/path.ts
+++ b/src/providers/node/path/path.ts
@@ -4,7 +4,7 @@ export type NodePathProvider = {
join: (...paths: string[]) => string;
dirname: (path: string) => string;
extname: (path: string) => string;
- basename: (path: string) => string;
+ basename: (path: string, suffix?: string) => string;
relative: (pathOne: string, pathTwo: string) => string;
resolve: (...paths: string[]) => string;
sep: string;
@@ -28,7 +28,7 @@ const nodePath: NodePathProvider = {
join: (...args) => getImplementation().join(...args),
dirname: path => getImplementation().dirname(path),
extname: path => getImplementation().extname(path),
- basename: path => getImplementation().basename(path),
+ basename: (path, suffix) => getImplementation().basename(path, suffix),
relative: (pathOne, pathTwo) => getImplementation().relative(pathOne, pathTwo),
resolve: (...args) => getImplementation().resolve(...args),
get sep() { return getImplementation().sep }
diff --git a/src/store/index.ts b/src/store/index.ts
index 4de52fc91..c2a7d8216 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,12 +1,12 @@
import { ActionContext, createStore } from 'vuex';
-import ErrorModule from './modules/ErrorModule';
-import { DownloadModule } from './modules/DownloadModule';
-import ModalsModule from './modules/ModalsModule';
+import ErrorModule, { State as ErrorState } from './modules/ErrorModule';
+import { DownloadModule, State as DownloadState } from './modules/DownloadModule';
+import ModalsModule, { State as ModalsState } from './modules/ModalsModule';
import ModFilterModule, { State as ModFilterState } from './modules/ModFilterModule';
-import ProfileModule from './modules/ProfileModule';
-import ProfileExportModule from './modules/ProfileExportModule';
-import { ProfilesModule } from './modules/ProfilesModule';
+import ProfileModule, { State as ProfileState } from './modules/ProfileModule';
+import ProfileExportModule, { State as ProfileExportState } from './modules/ProfileExportModule';
+import { ProfilesModule, State as ProfilesState } from './modules/ProfilesModule';
import { TsModsModule, State as TsModsState } from './modules/TsModsModule';
import { FolderMigration } from '../migrations/FolderMigration';
import Game from '../model/game/Game';
@@ -14,8 +14,8 @@ import GameManager from '../model/game/GameManager';
import R2Error from '../model/errors/R2Error';
import { getModLoaderPackageNames } from '../r2mm/installing/profile_installers/ModLoaderVariantRecord';
import ManagerSettings from '../r2mm/manager/ManagerSettings';
-import { SplashModule } from './modules/SplashModule';
-import { EcosystemUpdateModule } from './modules/EcosystemUpdateModule';
+import { SplashModule, State as SplashState } from './modules/SplashModule';
+import { EcosystemUpdateModule, EcosystemUpdateState } from './modules/EcosystemUpdateModule';
export interface State {
activeGame: Game;
@@ -24,6 +24,14 @@ export interface State {
_settings: ManagerSettings | null;
modFilters: ModFilterState;
tsMods: TsModsState;
+ profile: ProfileState;
+ modals: ModalsState;
+ download: DownloadState;
+ error: ErrorState;
+ profileExport: ProfileExportState;
+ ecosystemUpdate: EcosystemUpdateState;
+ profiles: ProfilesState;
+ splash: SplashState;
}
type Context = ActionContext;
diff --git a/src/store/modules/DownloadModule.ts b/src/store/modules/DownloadModule.ts
index aad88dd60..eb348a28c 100644
--- a/src/store/modules/DownloadModule.ts
+++ b/src/store/modules/DownloadModule.ts
@@ -39,7 +39,7 @@ interface UpdateObject {
status?: DownloadStatusEnum;
}
-interface State {
+export interface State {
allDownloads: DownloadProgress[],
ignoreCache: boolean,
}
diff --git a/src/store/modules/ErrorModule.ts b/src/store/modules/ErrorModule.ts
index 38acf5571..884ba37bf 100644
--- a/src/store/modules/ErrorModule.ts
+++ b/src/store/modules/ErrorModule.ts
@@ -1,7 +1,7 @@
import R2Error from "../../model/errors/R2Error";
import LoggerProvider, { LogSeverity } from '../../providers/ror2/logging/LoggerProvider';
-interface State {
+export interface State {
error: R2Error | null;
}
diff --git a/src/store/modules/ModalsModule.ts b/src/store/modules/ModalsModule.ts
index 5b7e6b5aa..2dfd030df 100644
--- a/src/store/modules/ModalsModule.ts
+++ b/src/store/modules/ModalsModule.ts
@@ -1,7 +1,7 @@
import ManifestV2 from "../../model/ManifestV2";
import ThunderstoreMod from "../../model/ThunderstoreMod";
-interface State {
+export interface State {
associatedModsModalMod: ManifestV2 | null;
disableModModalMod: ManifestV2 | null;
downloadModalMod: ThunderstoreMod | null;
diff --git a/src/store/modules/ProfileExportModule.ts b/src/store/modules/ProfileExportModule.ts
index c0c746d87..800b67bd4 100644
--- a/src/store/modules/ProfileExportModule.ts
+++ b/src/store/modules/ProfileExportModule.ts
@@ -4,7 +4,7 @@ import InteractionProvider from '../../providers/ror2/system/InteractionProvider
import { ActionTree, MutationTree } from 'vuex';
import { State as RootState } from '../../store';
-interface State {
+export interface State {
exportCode?: string | undefined;
}
diff --git a/src/store/modules/ProfileModule.ts b/src/store/modules/ProfileModule.ts
index 06de50e35..be9459228 100644
--- a/src/store/modules/ProfileModule.ts
+++ b/src/store/modules/ProfileModule.ts
@@ -26,7 +26,7 @@ export interface UnsatisfiedDependencies {
missingDependencies: string[];
}
-interface State {
+export interface State {
activeProfile: Profile | null;
expandedByDefault: boolean;
funkyMode: boolean;
diff --git a/src/store/modules/ProfilesModule.ts b/src/store/modules/ProfilesModule.ts
index 8cba6c7d1..7f6ebcda2 100644
--- a/src/store/modules/ProfilesModule.ts
+++ b/src/store/modules/ProfilesModule.ts
@@ -6,7 +6,7 @@ import Profile from "../../model/Profile";
import FsProvider from "../../providers/generic/file/FsProvider";
import path from "../../providers/node/path/path";
-interface State {
+export interface State {
profileList: string[];
}
diff --git a/src/store/modules/SplashModule.ts b/src/store/modules/SplashModule.ts
index ffa8ab0cd..42e21bce2 100644
--- a/src/store/modules/SplashModule.ts
+++ b/src/store/modules/SplashModule.ts
@@ -3,7 +3,7 @@ import { ActionTree } from 'vuex';
import { State as RootState } from "../../store";
import type { PackageListIndex } from './TsModsModule';
-interface State {
+export interface State {
requests: RequestItem[];
splashText: string;
}
diff --git a/src/utils/DateUtils.ts b/src/utils/DateUtils.ts
index 7d4ffaf15..4cfe21731 100644
--- a/src/utils/DateUtils.ts
+++ b/src/utils/DateUtils.ts
@@ -1,4 +1,4 @@
-export function valueToReadableDate(date: number | Date): string {
+export function valueToReadableDate(date: number | Date | string): string {
const dateObject: Date = new Date(date);
return `${dateObject.toDateString()}, ${dateObject.toLocaleTimeString()}`
}
diff --git a/test/vitest/tests/utils/utils.getDeprecatedPackageMap.ts.spec.ts b/test/vitest/tests/utils/utils.getDeprecatedPackageMap.ts.spec.ts
index 99c9c2466..782c03e80 100644
--- a/test/vitest/tests/utils/utils.getDeprecatedPackageMap.ts.spec.ts
+++ b/test/vitest/tests/utils/utils.getDeprecatedPackageMap.ts.spec.ts
@@ -2,7 +2,7 @@ import ThunderstoreMod from "../../../../src/model/ThunderstoreMod";
import ThunderstoreVersion from "../../../../src/model/ThunderstoreVersion";
import { Deprecations } from "../../../../src/utils/Deprecations";
import {describe, beforeEach, afterEach, test, expect, vi} from 'vitest';
-import { MockInstance } from '@vitest/spy';
+import type { MockInstance } from 'vitest';
// TODO: The implementation is currently intentionally broken (see the