diff --git a/src/back/ConfigFile.ts b/src/back/ConfigFile.ts index 83392b1d5..742a75127 100644 --- a/src/back/ConfigFile.ts +++ b/src/back/ConfigFile.ts @@ -1,5 +1,5 @@ import { AppConfigData } from '@shared/config/interfaces'; -import { getDefaultConfigData, overwriteConfigData } from '@shared/config/util'; +import { getDefaultConfigData, overwriteConfigData } from '@back/config/util'; import { deepCopy, readJsonFile, readJsonFileSync, stringifyJsonDataFile } from '@shared/Util'; import * as fs from 'fs'; diff --git a/src/back/ExtConfigFile.ts b/src/back/ExtConfigFile.ts index ed2c2d913..8da6b596e 100644 --- a/src/back/ExtConfigFile.ts +++ b/src/back/ExtConfigFile.ts @@ -1,5 +1,5 @@ import { AppExtConfigData } from '@shared/config/interfaces'; -import { overwriteExtConfigData } from '@shared/config/util'; +import { overwriteExtConfigData } from '@back/config/util'; import { readJsonFile, readJsonFileSync, stringifyJsonDataFile } from '@shared/Util'; import * as fs from 'fs'; diff --git a/src/shared/config/util.ts b/src/back/config/util.ts similarity index 100% rename from src/shared/config/util.ts rename to src/back/config/util.ts diff --git a/src/back/extensions/ApiImplementation.ts b/src/back/extensions/ApiImplementation.ts index ceafe0e14..954ef07d1 100644 --- a/src/back/extensions/ApiImplementation.ts +++ b/src/back/extensions/ApiImplementation.ts @@ -15,7 +15,7 @@ import { BrowsePageLayout } from '@shared/BrowsePageLayout'; import { IExtensionManifest } from '@shared/extensions/interfaces'; import { ProcessState } from '@shared/interfaces'; import { ILogEntry, LogLevel } from '@shared/Log/interface'; -import { PreferencesFile } from '@shared/preferences/PreferencesFile'; +import { PreferencesFile } from '@back/preferences/PreferencesFile'; import { overwritePreferenceData } from '@shared/preferences/util'; import * as flashpoint from 'flashpoint-launcher'; import { extractFull } from 'node-7z'; diff --git a/src/back/extensions/ExtensionService.ts b/src/back/extensions/ExtensionService.ts index dc83f7042..441365619 100644 --- a/src/back/extensions/ExtensionService.ts +++ b/src/back/extensions/ExtensionService.ts @@ -4,7 +4,7 @@ import { Disposable, dispose, newDisposable } from '@back/util/lifecycle'; import { TernarySearchTree } from '@back/util/map'; import { AppConfigData } from '@shared/config/interfaces'; import { ILogEntry } from '@shared/Log/interface'; -import { Contributions, ExtensionContribution, IExtension } from '../../shared/extensions/interfaces'; +import { Contributions, ExtensionContribution, IExtension } from '@shared/extensions/interfaces'; import { scanExtensions } from './ExtensionsScanner'; import { getExtensionEntry, newExtLog } from './ExtensionUtils'; import { ExtensionContext, ExtensionData, ExtensionModule } from './types'; diff --git a/src/back/extensions/ExtensionsScanner.ts b/src/back/extensions/ExtensionsScanner.ts index ee47f7209..51b4498f7 100644 --- a/src/back/extensions/ExtensionsScanner.ts +++ b/src/back/extensions/ExtensionsScanner.ts @@ -4,7 +4,7 @@ import { Coerce } from '@shared/utils/Coerce'; import { IObjectParserProp, ObjectParser } from '@shared/utils/ObjectParser'; import * as fs from 'fs'; import * as path from 'path'; -import { Application, ButtonContext, ContextButton, Contributions, DevScript, ExtConfiguration, ExtConfigurationProp, ExtensionType, ExtTheme, IExtension, IExtensionManifest, ILogoSet } from '../../shared/extensions/interfaces'; +import { Application, ButtonContext, ContextButton, Contributions, DevScript, ExtConfiguration, ExtConfigurationProp, ExtensionType, ExtTheme, IExtension, IExtensionManifest, ILogoSet } from '@shared/extensions/interfaces'; const { str, num } = Coerce; const fsPromises = fs.promises; diff --git a/src/back/index.ts b/src/back/index.ts index 6ec5683b4..969373f19 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -22,7 +22,7 @@ import { ILogoSet, LogoSet } from '@shared/extensions/interfaces'; import { IBackProcessInfo, RecursivePartial } from '@shared/interfaces'; import { getDefaultLocalization, LangFileContent } from '@shared/lang'; import { ILogEntry, LogLevel } from '@shared/Log/interface'; -import { PreferencesFile } from '@shared/preferences/PreferencesFile'; +import { PreferencesFile } from '@back/preferences/PreferencesFile'; import { defaultPreferencesData } from '@shared/preferences/util'; import { Theme } from '@shared/ThemeFile'; import { createErrorProxy, deepCopy, removeFileExtension, stringifyArray } from '@shared/Util'; diff --git a/src/shared/preferences/PreferencesFile.ts b/src/back/preferences/PreferencesFile.ts similarity index 96% rename from src/shared/preferences/PreferencesFile.ts rename to src/back/preferences/PreferencesFile.ts index ab9968980..d06fd4be7 100644 --- a/src/shared/preferences/PreferencesFile.ts +++ b/src/back/preferences/PreferencesFile.ts @@ -1,9 +1,9 @@ import { getTempFilename } from '@back/util/misc'; import * as fs from 'fs'; import * as path from 'path'; -import { deepCopy, readJsonFile, readJsonFileSync, stringifyJsonDataFile } from '../Util'; -import { AppPreferencesData } from './interfaces'; -import { defaultPreferencesData, overwritePreferenceData } from './util'; +import { deepCopy, readJsonFile, readJsonFileSync, stringifyJsonDataFile } from '@shared/Util'; +import { AppPreferencesData } from '@shared/preferences/interfaces'; +import { defaultPreferencesData, overwritePreferenceData } from '@shared/preferences/util'; /** Static class with methods for saving, loading and parsing the Preferences file */ export namespace PreferencesFile { diff --git a/src/back/responses.ts b/src/back/responses.ts index 495b957fe..85733387e 100644 --- a/src/back/responses.ts +++ b/src/back/responses.ts @@ -6,7 +6,7 @@ import { Tag } from '@database/entity/Tag'; import { TagAlias } from '@database/entity/TagAlias'; import { TagCategory } from '@database/entity/TagCategory'; import { BackIn, BackInit, BackOut, DownloadDetails } from '@shared/back/types'; -import { overwriteConfigData } from '@shared/config/util'; +import { overwriteConfigData } from '@back/config/util'; import { LOGOS, SCREENSHOTS } from '@shared/constants'; import { convertGameToCurationMetaFile } from '@shared/curate/metaToMeta'; import { getContentFolderByKey } from '@shared/curate/util'; @@ -15,7 +15,7 @@ import { FilterGameOpts } from '@shared/game/GameFilter'; import { DeepPartial, GamePropSuggestions, ProcessAction, ProcessState } from '@shared/interfaces'; import { LogLevel } from '@shared/Log/interface'; import { MetaEditFile, MetaEditMeta } from '@shared/MetaEdit'; -import { PreferencesFile } from '@shared/preferences/PreferencesFile'; +import { PreferencesFile } from '@back/preferences/PreferencesFile'; import { defaultPreferencesData, overwritePreferenceData } from '@shared/preferences/util'; import { deepCopy, padEnd } from '@shared/Util'; import { sanitizeFilename } from '@shared/utils/sanitizeFilename'; diff --git a/src/main/BrowserMode.ts b/src/main/BrowserMode.ts index 275d77ce5..cbc9c8ccd 100644 --- a/src/main/BrowserMode.ts +++ b/src/main/BrowserMode.ts @@ -3,7 +3,7 @@ import { CONFIG_FILENAME, PREFERENCES_FILENAME } from '@back/constants'; import * as remoteMain from '@electron/remote/main'; import { AppConfigData } from '@shared/config/interfaces'; import { AppPreferencesData } from '@shared/preferences/interfaces'; -import { PreferencesFile } from '@shared/preferences/PreferencesFile'; +import { PreferencesFile } from '@back/preferences/PreferencesFile'; import { createErrorProxy } from '@shared/Util'; import { app, BrowserWindow, session, shell } from 'electron'; import * as fs from 'fs'; diff --git a/src/shared/IPC.ts b/src/main/IPC.ts similarity index 100% rename from src/shared/IPC.ts rename to src/main/IPC.ts diff --git a/src/main/LogsWindow.ts b/src/main/LogsWindow.ts index f0c0c4ace..fe74b1bea 100644 --- a/src/main/LogsWindow.ts +++ b/src/main/LogsWindow.ts @@ -4,9 +4,9 @@ import * as remoteMain from '@electron/remote/main'; import { SocketClient } from '@shared/back/SocketClient'; import { BackOut } from '@shared/back/types'; import { AppConfigData } from '@shared/config/interfaces'; -import { InitRendererChannel, InitRendererData } from '@shared/IPC'; +import { InitRendererChannel, InitRendererData } from '@main/IPC'; import { AppPreferencesData } from '@shared/preferences/interfaces'; -import { PreferencesFile } from '@shared/preferences/PreferencesFile'; +import { PreferencesFile } from '@back/preferences/PreferencesFile'; import { createErrorProxy } from '@shared/Util'; import { randomBytes } from 'crypto'; import { app, BrowserWindow, ipcMain, IpcMainEvent, session, shell } from 'electron'; diff --git a/src/main/Main.ts b/src/main/Main.ts index 827d7ca05..54e53b09a 100644 --- a/src/main/Main.ts +++ b/src/main/Main.ts @@ -4,7 +4,7 @@ import { BackIn, BackInitArgs, BackOut } from '@shared/back/types'; import { AppConfigData } from '@shared/config/interfaces'; import { APP_TITLE } from '@shared/constants'; import { WindowIPC } from '@shared/interfaces'; -import { InitRendererChannel, InitRendererData } from '@shared/IPC'; +import { InitRendererChannel, InitRendererData } from '@main/IPC'; import { AppPreferencesData } from '@shared/preferences/interfaces'; import { createErrorProxy } from '@shared/Util'; import { ChildProcess, fork } from 'child_process'; diff --git a/src/main/MainWindowPreload.ts b/src/main/MainWindowPreload.ts index 4c92c1fff..2d677c25b 100644 --- a/src/main/MainWindowPreload.ts +++ b/src/main/MainWindowPreload.ts @@ -1,7 +1,7 @@ import * as remote from '@electron/remote'; import { SocketClient } from '@shared/back/SocketClient'; import { BackIn, BackOut } from '@shared/back/types'; -import { InitRendererChannel, InitRendererData } from '@shared/IPC'; +import { InitRendererChannel, InitRendererData } from '@main/IPC'; import { setTheme } from '@shared/Theme'; import { createErrorProxy } from '@shared/Util'; import * as electron from 'electron'; diff --git a/src/shared/Log/LogCommon.ts b/src/renderer/Log/LogCommon.ts similarity index 97% rename from src/shared/Log/LogCommon.ts rename to src/renderer/Log/LogCommon.ts index ddce193a8..c5c2d5a24 100644 --- a/src/shared/Log/LogCommon.ts +++ b/src/renderer/Log/LogCommon.ts @@ -1,5 +1,5 @@ -import { padStart } from '../Util'; -import { ILogEntry, LogLevel } from './interface'; +import { padStart } from '@shared/Util'; +import { ILogEntry, LogLevel } from '@shared/Log/interface'; export const timeChars = 11; // "[HH:MM:SS] " const sourceChars = 19; // "Background Services" (sometimes used with +2 to add the length of ": ") diff --git a/src/renderer/app.tsx b/src/renderer/app.tsx index 0ebcd7df2..2faac3cad 100644 --- a/src/renderer/app.tsx +++ b/src/renderer/app.tsx @@ -6,13 +6,13 @@ import { BackIn, BackInit, BackOut } from '@shared/back/types'; import { APP_TITLE, VIEW_PAGE_SIZE } from '@shared/constants'; import { IService, ProcessState, WindowIPC } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import { updatePreferencesData } from '@shared/preferences/util'; import { setTheme } from '@shared/Theme'; -import { getUpgradeString } from '@shared/upgrade/util'; +import { getUpgradeString } from '@renderer/util/upgrade'; import { canReadWrite, deepCopy, getFileServerURL, recursiveReplace, sizeToString } from '@shared/Util'; -import { arrayShallowStrictEquals } from '@shared/utils/compare'; -import { debounce } from '@shared/utils/debounce'; +import { arrayShallowStrictEquals } from '@renderer/util/compare'; +import { debounce } from '@renderer/util/debounce'; import { formatString } from '@shared/utils/StringFormatter'; import { clipboard, ipcRenderer, Menu, MenuItemConstructorOptions } from 'electron'; import { AppUpdater } from 'electron-updater'; diff --git a/src/renderer/components/ConfigBoxSelect.tsx b/src/renderer/components/ConfigBoxSelect.tsx index ec0c13129..d173d943a 100644 --- a/src/renderer/components/ConfigBoxSelect.tsx +++ b/src/renderer/components/ConfigBoxSelect.tsx @@ -1,4 +1,4 @@ -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import * as React from 'react'; import { ConfigBox, ConfigBoxProps } from './ConfigBox'; diff --git a/src/renderer/components/DropdownInputField.tsx b/src/renderer/components/DropdownInputField.tsx index 9617c9fbc..62e1edf69 100644 --- a/src/renderer/components/DropdownInputField.tsx +++ b/src/renderer/components/DropdownInputField.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import { checkIfAncestor } from '../Util'; import { InputField, InputFieldProps } from './InputField'; diff --git a/src/renderer/components/Footer.tsx b/src/renderer/components/Footer.tsx index a3595b96a..371a40feb 100644 --- a/src/renderer/components/Footer.tsx +++ b/src/renderer/components/Footer.tsx @@ -2,7 +2,7 @@ import { WithMainStateProps } from '@renderer/containers/withMainState'; import { MainActionType } from '@renderer/store/main/enums'; import { parseBrowsePageLayout, stringifyBrowsePageLayout } from '@shared/BrowsePageLayout'; import { LangContainer } from '@shared/lang'; -import { getLibraryItemTitle } from '@shared/library/util'; +import { getLibraryItemTitle } from '@renderer/util/library'; import { updatePreferencesData } from '@shared/preferences/util'; import * as React from 'react'; import { RouteComponentProps } from 'react-router-dom'; diff --git a/src/renderer/components/GameDataBrowser.tsx b/src/renderer/components/GameDataBrowser.tsx index 2686e4b18..3da84ef32 100644 --- a/src/renderer/components/GameDataBrowser.tsx +++ b/src/renderer/components/GameDataBrowser.tsx @@ -4,7 +4,7 @@ import { SourceData } from '@database/entity/SourceData'; import { LangContext } from '@renderer/util/lang'; import { BackIn } from '@shared/back/types'; import { LangContainer } from '@shared/lang'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import * as React from 'react'; import { FloatingContainer } from './FloatingContainer'; import { GameDataInfo } from './GameDataInfo'; diff --git a/src/renderer/components/GameGrid.tsx b/src/renderer/components/GameGrid.tsx index 487e41305..e09ad6f1e 100644 --- a/src/renderer/components/GameGrid.tsx +++ b/src/renderer/components/GameGrid.tsx @@ -1,6 +1,6 @@ import { BackOut, BackOutTemplate } from '@shared/back/types'; import { LOGOS, VIEW_PAGE_SIZE } from '@shared/constants'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import * as React from 'react'; import { ArrowKeyStepper, AutoSizer, ScrollIndices } from 'react-virtualized'; import { Grid, GridCellProps, RenderedSection } from 'react-virtualized/dist/es/Grid'; diff --git a/src/renderer/components/GameList.tsx b/src/renderer/components/GameList.tsx index a7ee793b6..1fe57ea46 100644 --- a/src/renderer/components/GameList.tsx +++ b/src/renderer/components/GameList.tsx @@ -1,6 +1,6 @@ import { withPreferences, WithPreferencesProps } from '@renderer/containers/withPreferences'; import { VIEW_PAGE_SIZE } from '@shared/constants'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import * as React from 'react'; import { ArrowKeyStepper, AutoSizer, List, ListRowProps, ScrollIndices } from 'react-virtualized'; import { UpdateView, ViewGameSet } from '../interfaces'; diff --git a/src/renderer/components/Header.tsx b/src/renderer/components/Header.tsx index 7bba0c8d7..beccb0575 100644 --- a/src/renderer/components/Header.tsx +++ b/src/renderer/components/Header.tsx @@ -1,7 +1,7 @@ import { WithTagCategoriesProps } from '@renderer/containers/withTagCategories'; import { BackIn, TagSuggestion } from '@shared/back/types'; import { LangContainer } from '@shared/lang'; -import { getLibraryItemTitle } from '@shared/library/util'; +import { getLibraryItemTitle } from '@renderer/util/library'; import { GameOrderBy, GameOrderReverse } from '@shared/order/interfaces'; import * as React from 'react'; import { Link, RouteComponentProps, useLocation } from 'react-router-dom'; diff --git a/src/renderer/components/LeftBrowseSidebar.tsx b/src/renderer/components/LeftBrowseSidebar.tsx index 26b966367..80c363357 100644 --- a/src/renderer/components/LeftBrowseSidebar.tsx +++ b/src/renderer/components/LeftBrowseSidebar.tsx @@ -1,6 +1,6 @@ import { Playlist } from '@database/entity/Playlist'; import { LangContainer } from '@shared/lang'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import * as React from 'react'; import { WithPreferencesProps } from '../containers/withPreferences'; import { gameIdDataType } from '../Util'; diff --git a/src/renderer/components/RightBrowseSidebar.tsx b/src/renderer/components/RightBrowseSidebar.tsx index 5404d3bc3..cd65c7235 100644 --- a/src/renderer/components/RightBrowseSidebar.tsx +++ b/src/renderer/components/RightBrowseSidebar.tsx @@ -7,7 +7,7 @@ import { WithConfirmDialogProps } from '@renderer/containers/withConfirmDialog'; import { BackIn, BackOut, BackOutTemplate, TagSuggestion } from '@shared/back/types'; import { LOGOS, SCREENSHOTS } from '@shared/constants'; import { wrapSearchTerm } from '@shared/game/GameFilter'; -import { ModelUtils } from '@shared/game/util'; +import { ModelUtils } from '@renderer/util/game'; import { GamePropSuggestions, PickType, ProcessAction } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; import { deepCopy, generateTagFilterGroup, sizeToString } from '@shared/Util'; diff --git a/src/renderer/components/ServiceBox.tsx b/src/renderer/components/ServiceBox.tsx index 2c64c918f..f04d1e371 100644 --- a/src/renderer/components/ServiceBox.tsx +++ b/src/renderer/components/ServiceBox.tsx @@ -3,7 +3,7 @@ import { BackIn } from '@shared/back/types'; import { IBackProcessInfo, IService, ProcessAction, ProcessState } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; import { ILogEntry } from '@shared/Log/interface'; -import { escapeHTML, formatTime, padLines, timeChars } from '@shared/Log/LogCommon'; +import { escapeHTML, formatTime, padLines, timeChars } from '@renderer/Log/LogCommon'; import * as React from 'react'; import { setInterval } from 'timers'; import { LangContext } from '../util/lang'; diff --git a/src/renderer/components/TagInputField.tsx b/src/renderer/components/TagInputField.tsx index 8c9a51aa0..9cf532140 100644 --- a/src/renderer/components/TagInputField.tsx +++ b/src/renderer/components/TagInputField.tsx @@ -1,7 +1,7 @@ import { Tag } from '@database/entity/Tag'; import { TagCategory } from '@database/entity/TagCategory'; import { TagSuggestion } from '@shared/back/types'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import * as React from 'react'; import { checkIfAncestor } from '../Util'; import { InputField, InputFieldProps } from './InputField'; diff --git a/src/renderer/components/pages/AboutPage.tsx b/src/renderer/components/pages/AboutPage.tsx index d1e2b5e9b..eb434aea0 100644 --- a/src/renderer/components/pages/AboutPage.tsx +++ b/src/renderer/components/pages/AboutPage.tsx @@ -1,5 +1,5 @@ import { LangContainer } from '@shared/lang'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import { versionNumberToText } from '@shared/Util'; import * as React from 'react'; import { CreditsBlock, CreditsData, CreditsDataProfile, CreditsDataRole } from '../../credits/types'; diff --git a/src/renderer/components/pages/BrowsePage.tsx b/src/renderer/components/pages/BrowsePage.tsx index 8a2fa46cc..de9015447 100644 --- a/src/renderer/components/pages/BrowsePage.tsx +++ b/src/renderer/components/pages/BrowsePage.tsx @@ -8,7 +8,7 @@ import { BrowsePageLayout } from '@shared/BrowsePageLayout'; import { ExtensionContribution } from '@shared/extensions/interfaces'; import { GamePropSuggestions } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import { updatePreferencesData } from '@shared/preferences/util'; import { formatString } from '@shared/utils/StringFormatter'; import { uuid } from '@shared/utils/uuid'; diff --git a/src/renderer/components/pages/ConfigPage.tsx b/src/renderer/components/pages/ConfigPage.tsx index a222e6e0d..07f11f946 100644 --- a/src/renderer/components/pages/ConfigPage.tsx +++ b/src/renderer/components/pages/ConfigPage.tsx @@ -5,7 +5,7 @@ import { BackIn } from '@shared/back/types'; import { AppExtConfigData } from '@shared/config/interfaces'; import { ExtConfigurationProp, ExtensionContribution, IExtensionDescription, ILogoSet } from '@shared/extensions/interfaces'; import { autoCode, LangContainer, LangFile } from '@shared/lang'; -import { memoizeOne } from '@shared/memoize'; +import { memoizeOne } from '@renderer/util/memoize'; import { updatePreferencesData, updatePreferencesDataAsync } from '@shared/preferences/util'; import { ITheme } from '@shared/ThemeFile'; import { deepCopy } from '@shared/Util'; diff --git a/src/renderer/components/pages/CuratePage.tsx b/src/renderer/components/pages/CuratePage.tsx index 8d24c7f43..56a143c68 100644 --- a/src/renderer/components/pages/CuratePage.tsx +++ b/src/renderer/components/pages/CuratePage.tsx @@ -8,8 +8,8 @@ import { CurationIndex, EditCuration, EditCurationMeta } from '@shared/curate/ty import { getContentFolderByKey, getCurationFolder, indexContentFolder } from '@shared/curate/util'; import { GamePropSuggestions } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; -import { getLibraryItemTitle } from '@shared/library/util'; -import { memoizeOne } from '@shared/memoize'; +import { getLibraryItemTitle } from '@renderer/util/library'; +import { memoizeOne } from '@renderer/util/memoize'; import { updatePreferencesData } from '@shared/preferences/util'; import * as fs from 'fs-extra'; import * as path from 'path'; diff --git a/src/renderer/components/pages/DeveloperPage.tsx b/src/renderer/components/pages/DeveloperPage.tsx index a70600a32..9acc283d4 100644 --- a/src/renderer/components/pages/DeveloperPage.tsx +++ b/src/renderer/components/pages/DeveloperPage.tsx @@ -9,7 +9,7 @@ import { LOGOS, SCREENSHOTS } from '@shared/constants'; import { DevScript, ExtensionContribution } from '@shared/extensions/interfaces'; import { ExecMapping, IService } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; -import { Legacy_PlatformFileIterator } from '@shared/legacy/GameManager'; +import { Legacy_PlatformFileIterator } from '@renderer/legacy/GameManager'; import { stringifyMetaValue } from '@shared/MetaEdit'; import * as fs from 'fs-extra'; import * as path from 'path'; diff --git a/src/renderer/components/pages/HomePage.tsx b/src/renderer/components/pages/HomePage.tsx index a76c6521a..7b81e17ba 100644 --- a/src/renderer/components/pages/HomePage.tsx +++ b/src/renderer/components/pages/HomePage.tsx @@ -6,7 +6,7 @@ import { ARCADE, THEATRE } from '@shared/constants'; import { wrapSearchTerm } from '@shared/game/GameFilter'; import { LangContainer } from '@shared/lang'; import { updatePreferencesData } from '@shared/preferences/util'; -import { getUpgradeString } from '@shared/upgrade/util'; +import { getUpgradeString } from '@renderer/util/upgrade'; import { formatString } from '@shared/utils/StringFormatter'; import { AppUpdater, UpdateInfo } from 'electron-updater'; import * as path from 'path'; diff --git a/src/renderer/components/pages/LogsPage.tsx b/src/renderer/components/pages/LogsPage.tsx index 512b21bdf..021421c28 100644 --- a/src/renderer/components/pages/LogsPage.tsx +++ b/src/renderer/components/pages/LogsPage.tsx @@ -3,8 +3,8 @@ import { BackIn, BackOut } from '@shared/back/types'; import { ArgumentTypesOf } from '@shared/interfaces'; import { LangContainer } from '@shared/lang'; import { LogLevel } from '@shared/Log/interface'; -import { stringifyLogEntries } from '@shared/Log/LogCommon'; -import { memoizeOne } from '@shared/memoize'; +import { stringifyLogEntries } from '@renderer/Log/LogCommon'; +import { memoizeOne } from '@renderer/util/memoize'; import { updatePreferencesData } from '@shared/preferences/util'; import { shallowStrictEquals } from '@shared/Util'; import { clipboard } from 'electron'; diff --git a/src/shared/legacy/GameManager.ts b/src/renderer/legacy/GameManager.ts similarity index 98% rename from src/shared/legacy/GameManager.ts rename to src/renderer/legacy/GameManager.ts index 515e27030..84f52a7c5 100644 --- a/src/shared/legacy/GameManager.ts +++ b/src/renderer/legacy/GameManager.ts @@ -3,7 +3,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { promisify } from 'util'; import { Legacy_GameParser } from './GameParser'; -import { Legacy_GamePlatform, Legacy_IRawPlatformFile } from './interfaces'; +import { Legacy_GamePlatform, Legacy_IRawPlatformFile } from '@shared/legacy/interfaces'; import { Legacy_errorCopy } from './misc'; import { Legacy_LoadPlatformError } from './types'; diff --git a/src/shared/legacy/GameParser.ts b/src/renderer/legacy/GameParser.ts similarity index 98% rename from src/shared/legacy/GameParser.ts rename to src/renderer/legacy/GameParser.ts index d194967e0..82df03d45 100644 --- a/src/shared/legacy/GameParser.ts +++ b/src/renderer/legacy/GameParser.ts @@ -1,4 +1,4 @@ -import { Legacy_IAdditionalApplicationInfo, Legacy_IGameCollection, Legacy_IGameInfo, Legacy_IRawPlatformFile, Legacy_IRawGameInfo, Legacy_IRawAdditionalApplicationInfo } from './interfaces'; +import { Legacy_IAdditionalApplicationInfo, Legacy_IGameCollection, Legacy_IGameInfo, Legacy_IRawPlatformFile, Legacy_IRawGameInfo, Legacy_IRawAdditionalApplicationInfo } from '@shared/legacy/interfaces'; export class Legacy_GameParser { public static parse(data: Legacy_IRawPlatformFile, filename: string): Legacy_IGameCollection { diff --git a/src/shared/legacy/misc.ts b/src/renderer/legacy/misc.ts similarity index 100% rename from src/shared/legacy/misc.ts rename to src/renderer/legacy/misc.ts diff --git a/src/shared/legacy/types.ts b/src/renderer/legacy/types.ts similarity index 100% rename from src/shared/legacy/types.ts rename to src/renderer/legacy/types.ts diff --git a/src/shared/utils/compare.ts b/src/renderer/util/compare.ts similarity index 100% rename from src/shared/utils/compare.ts rename to src/renderer/util/compare.ts diff --git a/src/shared/utils/debounce.ts b/src/renderer/util/debounce.ts similarity index 91% rename from src/shared/utils/debounce.ts rename to src/renderer/util/debounce.ts index a1c558a8d..4e36ba696 100644 --- a/src/shared/utils/debounce.ts +++ b/src/renderer/util/debounce.ts @@ -1,4 +1,4 @@ -import { AnyFunction, ArgumentTypesOf } from '../interfaces'; +import { AnyFunction, ArgumentTypesOf } from '@shared/interfaces'; /** A callable object that has the same argument types as T (and void as the return type). */ interface CallableCopy extends Function { diff --git a/src/shared/game/util.ts b/src/renderer/util/game.ts similarity index 89% rename from src/shared/game/util.ts rename to src/renderer/util/game.ts index 3344e912e..306169cde 100644 --- a/src/shared/game/util.ts +++ b/src/renderer/util/game.ts @@ -1,5 +1,5 @@ -import { AdditionalApp } from '../../database/entity/AdditionalApp'; -import { Game } from '../../database/entity/Game'; +import { AdditionalApp } from '@database/entity/AdditionalApp'; +import { Game } from '@database/entity/Game'; export namespace ModelUtils { export function createGame(): Game { diff --git a/src/shared/library/util.ts b/src/renderer/util/library.ts similarity index 88% rename from src/shared/library/util.ts rename to src/renderer/util/library.ts index 7dcb05b9b..304855246 100644 --- a/src/shared/library/util.ts +++ b/src/renderer/util/library.ts @@ -1,4 +1,4 @@ -import { LangContainer } from '../lang'; +import { LangContainer } from '@shared/lang'; /** * Get the title of a library item from a language sub-container (or return the item's route if none was found). diff --git a/src/shared/memoize.ts b/src/renderer/util/memoize.ts similarity index 92% rename from src/shared/memoize.ts rename to src/renderer/util/memoize.ts index 2fff37649..b4ecd6cc6 100644 --- a/src/shared/memoize.ts +++ b/src/renderer/util/memoize.ts @@ -1,5 +1,5 @@ -import { AnyFunction, ArgumentTypesOf, ReturnTypeOf } from './interfaces'; -import { shallowStrictEquals } from './Util'; +import { AnyFunction, ArgumentTypesOf, ReturnTypeOf } from '@shared/interfaces'; +import { shallowStrictEquals } from '@shared/Util'; /** Callable object, A is the arguments, R is the return value */ interface Callable extends Function { diff --git a/src/renderer/util/upgrade.ts b/src/renderer/util/upgrade.ts index 538124b2f..df2362017 100644 --- a/src/renderer/util/upgrade.ts +++ b/src/renderer/util/upgrade.ts @@ -1,4 +1,5 @@ import { indexContentFolder } from '@shared/curate/util'; +import { LangContainer } from '@shared/lang'; import * as crypto from 'crypto'; import { EventEmitter } from 'events'; import { http, https } from 'follow-redirects'; @@ -264,3 +265,8 @@ function createMiddleStream(onData: (length: number) => void): stream.Transform } }); } + +/** Returns the localized string for an upgrade (Or the same string, if none is found) */ +export function getUpgradeString(str: string, lang?: LangContainer['upgrades']) { + return lang && lang[str] || str; +} diff --git a/src/shared/game/interfaces.ts b/src/shared/game/interfaces.ts deleted file mode 100644 index 7f10ffa14..000000000 --- a/src/shared/game/interfaces.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { AdditionalApp } from '../../database/entity/AdditionalApp'; -import { Game } from '../../database/entity/Game'; -import { Playlist } from '../../database/entity/Playlist'; -import { OrderGamesOpts } from './GameFilter'; - -export const UNKNOWN_LIBRARY = 'unknown'; - -/** Server Response - Template for all responses */ -export type ServerResponse = { - /** Success of the request */ - success: boolean; - /** Error message if unsuccessful */ - error?: Error; - /** Response (if any) empty if unsuccessful */ - result?: any; -} - -/** Client Request - Fetch a game */ -export type FetchGameRequest = { - /** Id of the game */ - id: string; -} - -/** Server Response - Return a requested game */ -export type FetchGameResponse = { - /** Game found */ - game: Game; -} - -/** Client Request - Remove a game or additional application */ -export type GameAppDeleteRequest = { - /** ID of the game or addapp to remove */ - id: string; -} - -/** Client Request - Add a game */ -export type GameAddRequest = { - /** Game to add */ - game: Game; -} - -/** Client Request - Add an additional application */ -export type AppAddRequest = { - /** Add App to add */ - addApp: AdditionalApp; -} - -/** Client Request - Information needed to make a search */ -export type SearchRequest = { - /** String to use as a search query */ - query: string; - /** Offset to begin in a search result */ - offset: number; - /** Max number of results to return */ - limit: number; - /** Opts to search by */ - orderOpts: OrderGamesOpts; - /** Library to search (all if none) */ - library?: string; - /** Playlist to filter by (if any) */ - playlist?: Playlist; -} - -/** Server Response - List of games from a search */ -export type SearchResults = SearchRequest & { - /** Total number of results found */ - total: number; - /** Games returned from a search query */ - results: Game[]; -} diff --git a/src/shared/upgrade/util.ts b/src/shared/upgrade/util.ts deleted file mode 100644 index 8f3cea2e6..000000000 --- a/src/shared/upgrade/util.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { LangContainer } from '../lang'; - -/** Returns the localized string for an upgrade (Or the same string, if none is found) */ -export function getUpgradeString(str: string, lang?: LangContainer['upgrades']) { - return lang && lang[str] || str; -} diff --git a/tests/unit/back/configuration.test.ts b/tests/unit/back/configuration.test.ts index c7e026fa3..a64ff9733 100644 --- a/tests/unit/back/configuration.test.ts +++ b/tests/unit/back/configuration.test.ts @@ -1,5 +1,5 @@ import { AppConfigData } from '@shared/config/interfaces'; -import { getDefaultConfigData, overwriteConfigData } from '@shared/config/util'; +import { getDefaultConfigData, overwriteConfigData } from '@back/config/util'; import { AppPreferencesData } from '@shared/preferences/interfaces'; import { defaultPreferencesData, overwritePreferenceData } from '@shared/preferences/util'; import { deepCopy } from '@shared/Util';