Skip to content

Commit

Permalink
Another structure change
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Jun 16, 2024
1 parent 831c35e commit 5cfcd26
Show file tree
Hide file tree
Showing 93 changed files with 136 additions and 158 deletions.
2 changes: 1 addition & 1 deletion src/utils/blse/events.ts → src/blse/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { actions, types } from 'vortex-api';
import { hasSettingsInterfacePrimaryTool } from '../vortex';
import { GAME_ID } from '../../common';
import { GAME_ID } from '../common';
import { findBLSEMod } from '.';

export const didDeployBLSE = (api: types.IExtensionApi): void => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/blse/installer.ts → src/blse/installer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { selectors, types } from 'vortex-api';
import path from 'path';
import { isStoreXbox } from '../vortex';
import { BINARY_FOLDER_STANDARD, BINARY_FOLDER_XBOX, BLSE_CLI_EXE, GAME_ID } from '../../common';
import { BINARY_FOLDER_STANDARD, BINARY_FOLDER_XBOX, BLSE_CLI_EXE, GAME_ID } from '../common';

export const installBLSE = (api: types.IExtensionApi, files: string[]): Promise<types.IInstallResult> => {
const discovery: types.IDiscoveryResult | undefined = selectors.currentGameDiscovery(api.getState());
Expand Down
2 changes: 1 addition & 1 deletion src/utils/blse/modType.ts → src/blse/modType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { selectors, types } from 'vortex-api';
import { BLSE_CLI_EXE } from '../../common';
import { BLSE_CLI_EXE } from '../common';

export const getInstallPathBLSE = (api: types.IExtensionApi, game: types.IGame): string => {
const discovery: types.IDiscoveryResult | undefined = selectors.discoveryByGame(api.getState(), game.id);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/blse/utils.ts → src/blse/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { gte } from 'semver';
import { actions, selectors, types, util } from 'vortex-api';
import { IFileInfo } from '@nexusmods/nexus-api/lib';
import { BLSE_MOD_ID, BLSE_URL, GAME_ID } from '../../common';
import { BLSE_MOD_ID, BLSE_URL, GAME_ID } from '../common';
import { hasPersistentBannerlordMods } from '../vortex';
import { LocalizationManager } from '../localization';
import { IBannerlordMod } from '../../types';
import { IBannerlordMod } from '../types';

export const isModActive = (profile: types.IProfile, mod: IBannerlordMod): boolean => {
return profile.modState[mod.id]?.enabled ?? false;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions src/utils/butr/utils.ts → src/butr/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { types } from 'vortex-api';
import { VortexLauncherManager } from '../launcher';
import { versionToString } from '../version';
import { versionToString, VortexLauncherManager } from '../launcher';
import {
IModAnalyzerRequestModule,
IModAnalyzerRequestQuery,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { types } from 'vortex-api';
import { GAME_ID } from '../../common';
import { GAME_ID } from '../common';
import { hasBackupModOptions, removeOriginalModOptions, restoreOriginalModOptions } from '../modoptions';
import { LocalizationManager } from '../localization';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { selectors, types } from 'vortex-api';
import { GAME_ID } from '../../common';
import { GAME_ID } from '../common';
import { hasPersistentBannerlordMods, hasPersistentLoadOrder } from '../vortex';
import { findBLSEMod, forceInstallBLSE, isModActive } from '../blse';
import { vortexToPersistence } from '../loadOrder';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { actions, selectors, types } from 'vortex-api';
import { GAME_ID, SUB_MODS_IDS } from '../../common';
import { GAME_ID, SUB_MODS_IDS } from '../common';
import { actionsLoadOrder } from '../loadOrder';
import { VortexLauncherManager } from '../launcher';
import { VortexLoadOrderStorage } from '../../types';
import { VortexLoadOrderStorage } from '../types';
import { hasPersistentBannerlordMods } from '../vortex';
import { CollectionParseError, ICollectionData, ICollectionDataWithLegacyData } from '.';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { actions, selectors, types, util } from 'vortex-api';
import { GAME_ID } from '../../common';
import { IBannerlordMod, IModuleCache, VortexLoadOrderStorage } from '../../types';
import { GAME_ID } from '../common';
import { IBannerlordMod, IModuleCache, VortexLoadOrderStorage } from '../types';
import { actionsLoadOrder, persistenceToVortex } from '../loadOrder';
import { CollectionParseError, ICollectionDataWithGeneralData } from '.';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { types } from 'vortex-api';
import { ICollection as ICollectionDataToExport } from 'collections/src/types/ICollection';
import { IExtensionFeature } from 'collections/src/util/extension';
import { IModAttributes, IStatePersistent, PersistenceLoadOrderStorage } from '../../types';
import { IModAttributes, IStatePersistent, PersistenceLoadOrderStorage } from '../types';
import { PersistentModOptionsEntry } from '../modoptions';

export interface ICollectionData extends ICollectionDataToExport {}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/collections/utils.ts → src/collections/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { types } from 'vortex-api';
import { GAME_ID } from '../../common';
import { IStatePersistent } from '../../types';
import { GAME_ID } from '../common';
import { IStatePersistent } from '../types';
import {
IExtensionContextWithCollectionFeature as IExtensionContextWithCollection,
IModWithCollection,
Expand Down
3 changes: 2 additions & 1 deletion src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import Bluebird, { Promise, method as toBluebird } from 'bluebird';
import { types } from 'vortex-api';
import { EPICAPP_ID, GAME_ID, GOG_IDS, MODULES, STEAMAPP_ID, XBOX_ID } from './common';
import { findGame, getBannerlordMainExe, setup, VortexLauncherManager } from './utils';
import { findGame, getBannerlordMainExe, setup } from './vortex';
import { VortexLauncherManager } from './launcher';

export class BannerlordGame implements types.IGame {
private api: types.IExtensionApi;
Expand Down
48 changes: 20 additions & 28 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,40 @@ import Bluebird, { method as toBluebird } from 'bluebird';
import { log, selectors, types } from 'vortex-api';
import { TFunction } from 'vortex-api/lib/util/i18n';
import path from 'path';
import { GAME_ID } from './common';
import {
BannerlordGeneralDataPage,
ModOptionsDataPage,
SavePage,
SavePageOptions,
Settings,
SettingsProps,
} from './views';
import { BannerlordGame } from './game';
import { IAddedFiles } from './types';
import { reducer } from './react';
import { actionsSettings } from './settings';
import {
actionsSettings,
addedFilesEvent,
cloneCollectionGeneralData,
cloneCollectionModOptionsData,
didDeployBLSE,
didDeployLoadOrder,
didPurgeBLSE,
gamemodeActivatedLoadOrder,
gamemodeActivatedSave,
genCollectionGeneralData,
genCollectionModOptionsData,
getInstallPathBLSE,
getInstallPathModule,
hasContextWithCollectionFeature,
hasGeneralData,
hasLegacyData,
hasModOptionsData,
ICollectionData,
installBLSE,
isModTypeBLSE,
isModTypeModule,
LoadOrderManager,
parseCollectionGeneralData,
parseCollectionLegacyData,
parseCollectionModOptionsData,
reducer,
testBLSE,
VortexLauncherManager,
willRemoveModCollections,
} from './utils';
import { GAME_ID } from './common';
import {
BannerlordGeneralDataPage,
ModOptionsDataPage,
SavePage,
SavePageOptions,
Settings,
SettingsProps,
} from './views';
import { BannerlordGame } from './game';
import { IAddedFiles } from './types';
} from './collections';
import { didDeployLoadOrder, gamemodeActivatedLoadOrder, LoadOrderManager } from './loadOrder';
import { didDeployBLSE, didPurgeBLSE, getInstallPathBLSE, installBLSE, isModTypeBLSE, testBLSE } from './blse';
import { VortexLauncherManager } from './launcher';
import { getInstallPathModule, isModTypeModule } from './module';
import { gamemodeActivatedSave } from './save';
import { addedFilesEvent } from './vortex';
import { version } from '../package.json';

// TODO: Better dialogs with settings
Expand Down
2 changes: 1 addition & 1 deletion src/utils/launcher/hooks.ts → src/launcher/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useContext } from 'react';
import { MainContext } from 'vortex-api';
import { VortexLauncherManager } from './manager';
import { VortexLauncherManager } from '.';

export const useLauncher = (): VortexLauncherManager => {
const context = useContext(MainContext);
Expand Down
1 change: 1 addition & 0 deletions src/utils/launcher/index.ts → src/launcher/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './hooks';
export * from './manager';
export * from './version';
6 changes: 3 additions & 3 deletions src/utils/launcher/manager.ts → src/launcher/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
writeLoadOrder,
} from '../loadOrder';
import { getBetaSortingFromSettings } from '../settings';
import { filterEntryWithInvalidId } from '../util';
import { GAME_ID, SUB_MODS_IDS } from '../../common';
import { IModuleCache, VortexLoadOrderStorage, VortexStoreIds } from '../../types';
import { filterEntryWithInvalidId } from '../utils';
import { GAME_ID, SUB_MODS_IDS } from '../common';
import { IModuleCache, VortexLoadOrderStorage, VortexStoreIds } from '../types';
import { LocalizationManager } from '../localization';

export class VortexLauncherManager {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
PersistenceLoadOrderStorage,
VortexLoadOrderEntry,
VortexLoadOrderStorage,
} from '../../types';
} from '../types';
import { ValidationManager } from '../validation';
import { getModIds } from '../vortex';
import { getModIds } from '.';

export const persistenceToVortex = (
api: types.IExtensionApi,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/loadOrder/events.ts → src/loadOrder/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { types } from 'vortex-api';
import { LocalizationManager } from '../localization';
import { LoadOrderManager } from '../loadOrder';
import { LoadOrderManager } from '.';

/**
* Event function, be careful
Expand Down
2 changes: 1 addition & 1 deletion src/utils/loadOrder/hooks.ts → src/loadOrder/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useContext } from 'react';
import { MainContext } from 'vortex-api';
import { LoadOrderManager } from './manager';
import { LoadOrderManager } from '.';

export const useLoadOrder = (): LoadOrderManager => {
const context = useContext(MainContext);
Expand Down
1 change: 1 addition & 0 deletions src/utils/loadOrder/index.ts → src/loadOrder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export * from './converters';
export * from './events';
export * from './hooks';
export * from './manager';
export * from './utils';
export * from './vortex';
9 changes: 4 additions & 5 deletions src/utils/loadOrder/manager.ts → src/loadOrder/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import {
IModuleCompatibilityInfoCache,
ModAnalyzerProxy,
} from '../butr';
import { versionToString } from '../version';
import { GAME_ID } from '../../common';
import { LoadOrderInfoPanel, LoadOrderItemRenderer } from '../../views';
import { IVortexViewModelData, VortexLoadOrderStorage } from '../../types';
import { VortexLauncherManager } from '../launcher';
import { GAME_ID } from '../common';
import { LoadOrderInfoPanel, LoadOrderItemRenderer } from '../views';
import { IVortexViewModelData, VortexLoadOrderStorage } from '../types';
import { versionToString, VortexLauncherManager } from '../launcher';
import { LocalizationManager } from '../localization';
import { RequiredProperties } from '../types';
import { actionsLoadOrder } from '.';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/vortex/moduleUtil.ts → src/loadOrder/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { selectors, types } from 'vortex-api';
import { SUB_MODS_IDS } from '../../common';
import { SUB_MODS_IDS } from '../common';

type ModIdResult = {
id: string;
Expand Down
6 changes: 3 additions & 3 deletions src/utils/loadOrder/vortex.ts → src/loadOrder/vortex.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fs, selectors, types } from 'vortex-api';
import path from 'path';
import { GAME_ID, LOAD_ORDER_SUFFIX } from '../../common';
import { PersistenceLoadOrderStorage } from '../../types';
import { filterEntryWithInvalidId } from '../util';
import { GAME_ID, LOAD_ORDER_SUFFIX } from '../common';
import { PersistenceLoadOrderStorage } from '../types';
import { filterEntryWithInvalidId } from '../utils';

const getLoadOrderFileName = (profileId: string): string => {
return `${profileId}${LOAD_ORDER_SUFFIX}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useContext } from 'react';
import { MainContext } from 'vortex-api';
import { LocalizationManager } from './manager';
import { LocalizationManager } from '.';

export const useLocalization = (): LocalizationManager => {
const context = useContext(MainContext);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fs, types, util } from 'vortex-api';
import { Utils } from '@butr/vortexextensionnative';
import { Dirent } from 'fs';
import { I18N_NAMESPACE } from '../../common';
import { I18N_NAMESPACE } from '../common';
import { TranslateValues } from '.';

export const i18nToBannerlord = (languageCode: string): string => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/module/modType.ts → src/module/modType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { selectors, types } from 'vortex-api';
import { SUBMODULE_FILE } from '../../common';
import { SUBMODULE_FILE } from '../common';

export const getInstallPathModule = (api: types.IExtensionApi, game: types.IGame): string => {
const discovery: types.IDiscoveryResult | undefined = selectors.discoveryByGame(api.getState(), game.id);
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/react/reducers.ts → src/react/reducers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { actions, types, util } from 'vortex-api';
import { Utils } from '@butr/vortexextensionnative';
import { createReducer, ReducerHandler, ReducerHandlerState } from './redux';
import { nameof as nameof2 } from '../nameof';
import { actionsSave } from '../save';
import { actionsSettings, IBannerlordSettings } from '../settings';
import { i18nToBannerlord } from '../localization';
import { createReducer, ReducerHandler, ReducerHandlerState } from '.';

// TODO: Ask IDCs to provider a proper type system?
type SetLoadOrderPayload = {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/save/actions.ts → src/save/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAction } from 'redux-act';
import { EXTENSION_BASE_ID } from '../../common';
import { EXTENSION_BASE_ID } from '../common';

export type SetCurrentSavePayload = {
profileId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/save/events.ts → src/save/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { types } from 'vortex-api';
import { reloadSave } from './utils';
import { reloadSave } from '.';

/**
* Event function, be careful
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/settings/actions.ts → src/settings/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAction } from 'redux-act';
import { EXTENSION_BASE_ID } from '../../common';
import { EXTENSION_BASE_ID } from '../common';

export type SetSortOnDeployPayload = {
profileId: string;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/settings/types.ts → src/settings/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { types } from 'vortex-api';
import { GAME_ID } from '../../common';
import { GAME_ID } from '../common';

export interface IBannerlordSettings {
saveName: {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/settings/utils.ts → src/settings/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { types } from 'vortex-api';
import { ISettingsWithBannerlord } from './types';
import { hasSettings } from '../vortex';
import { GAME_ID } from '../../common';
import { GAME_ID } from '../common';
import { ISettingsWithBannerlord } from '.';

const hasSettingsBannerlord = (settings: types.ISettings): settings is ISettingsWithBannerlord => GAME_ID in settings;

Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { types } from 'vortex-api';
import { types as vetypes } from '@butr/vortexextensionnative';

export type RequiredProperties<T, P extends keyof T> = Omit<T, P> & Required<Pick<T, P>>;

export type IStatePersistent = types.IState['persistent'];

export type IModAttributes = types.IMod['attributes'];
Expand Down
File renamed without changes.
17 changes: 0 additions & 17 deletions src/utils/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/utils/types.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { types as vetypes } from '@butr/vortexextensionnative';
import { VortexLoadOrderStorage } from '../../types';
import { VortexLoadOrderStorage } from '../types';

export class ValidationManager implements vetypes.IValidationManager {
static fromVortex = (loadOrder: VortexLoadOrderStorage): ValidationManager => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext } from 'react';
import { FlexLayout, Icon, MainContext } from 'vortex-api';
import { openLoadOrderPage } from '../utils';
import { useLocalization } from '../../../utils';
import { useLocalization } from '../../../localization';

export const LoadOrderEditInfo = (): JSX.Element => {
const { localize: t } = useLocalization();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { ListGroupItem } from 'react-bootstrap';
import { IPersistenceLoadOrderEntry, VortexLoadOrderStorage } from '../../../types';
import { IModuleCompatibilityInfoCache, versionToString } from '../../../utils';
import { CompatibilityInfo, isOptional, ModuleIcon, OptionalBanner } from '../../Shared';
import { IModuleCompatibilityInfoCache } from '../../../butr';
import { versionToString } from '../../../launcher';

export type LoadOrderEntryProps = {
entry: IPersistenceLoadOrderEntry | undefined;
Expand Down
Loading

0 comments on commit 5cfcd26

Please sign in to comment.