diff options
Diffstat (limited to 'packages/main')
-rw-r--r-- | packages/main/.eslintrc.json | 6 | ||||
-rw-r--r-- | packages/main/esbuild.config.js | 1 | ||||
-rw-r--r-- | packages/main/package.json | 5 | ||||
-rw-r--r-- | packages/main/src/compositionRoot.ts | 10 | ||||
-rw-r--r-- | packages/main/src/controllers/__tests__/config.spec.ts | 8 | ||||
-rw-r--r-- | packages/main/src/controllers/__tests__/nativeTheme.spec.ts | 4 | ||||
-rw-r--r-- | packages/main/src/controllers/config.ts | 4 | ||||
-rw-r--r-- | packages/main/src/controllers/nativeTheme.ts | 4 | ||||
-rw-r--r-- | packages/main/src/index.ts | 6 | ||||
-rw-r--r-- | packages/main/src/services/ConfigPersistenceService.ts | 4 | ||||
-rw-r--r-- | packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts | 5 | ||||
-rw-r--r-- | packages/main/src/stores/MainStore.ts | 2 | ||||
-rw-r--r-- | packages/main/src/stores/SharedStore.ts | 2 |
13 files changed, 35 insertions, 26 deletions
diff --git a/packages/main/.eslintrc.json b/packages/main/.eslintrc.json new file mode 100644 index 0000000..6b736e2 --- /dev/null +++ b/packages/main/.eslintrc.json | |||
@@ -0,0 +1,6 @@ | |||
1 | { | ||
2 | "globals": { | ||
3 | "NodeJS": false, | ||
4 | "require": false | ||
5 | } | ||
6 | } | ||
diff --git a/packages/main/esbuild.config.js b/packages/main/esbuild.config.js index 500590f..c24d6e1 100644 --- a/packages/main/esbuild.config.js +++ b/packages/main/esbuild.config.js | |||
@@ -1,3 +1,4 @@ | |||
1 | /* eslint-disable no-process-env */ | ||
1 | import getRepoInfo from 'git-repo-info'; | 2 | import getRepoInfo from 'git-repo-info'; |
2 | import { node } from '../../config/buildConstants.js'; | 3 | import { node } from '../../config/buildConstants.js'; |
3 | import { getConfig } from '../../config/esbuildConfig.js'; | 4 | import { getConfig } from '../../config/esbuildConfig.js'; |
diff --git a/packages/main/package.json b/packages/main/package.json index b904906..e1b3f49 100644 --- a/packages/main/package.json +++ b/packages/main/package.json | |||
@@ -19,15 +19,18 @@ | |||
19 | "loglevel-plugin-prefix": "^0.8.4", | 19 | "loglevel-plugin-prefix": "^0.8.4", |
20 | "mobx": "^6.3.12", | 20 | "mobx": "^6.3.12", |
21 | "mobx-state-tree": "^5.1.0", | 21 | "mobx-state-tree": "^5.1.0", |
22 | "ms": "^2.1.3" | 22 | "ms": "^2.1.3", |
23 | "os-name": "^5.0.1" | ||
23 | }, | 24 | }, |
24 | "devDependencies": { | 25 | "devDependencies": { |
26 | "@jest/globals": "^27.4.4", | ||
25 | "@types/electron-devtools-installer": "^2.2.1", | 27 | "@types/electron-devtools-installer": "^2.2.1", |
26 | "@types/lodash-es": "^4.17.5", | 28 | "@types/lodash-es": "^4.17.5", |
27 | "@types/ms": "^0.7.31", | 29 | "@types/ms": "^0.7.31", |
28 | "@types/node": "^17.0.8", | 30 | "@types/node": "^17.0.8", |
29 | "electron-devtools-installer": "^3.2.0", | 31 | "electron-devtools-installer": "^3.2.0", |
30 | "esbuild": "^0.14.11", | 32 | "esbuild": "^0.14.11", |
33 | "git-repo-info": "^2.1.1", | ||
31 | "jest": "^27.4.7", | 34 | "jest": "^27.4.7", |
32 | "jest-mock": "^27.4.6", | 35 | "jest-mock": "^27.4.6", |
33 | "rimraf": "^3.0.2", | 36 | "rimraf": "^3.0.2", |
diff --git a/packages/main/src/compositionRoot.ts b/packages/main/src/compositionRoot.ts index bf0f92e..76835a1 100644 --- a/packages/main/src/compositionRoot.ts +++ b/packages/main/src/compositionRoot.ts | |||
@@ -20,11 +20,11 @@ | |||
20 | 20 | ||
21 | import { app } from 'electron'; | 21 | import { app } from 'electron'; |
22 | 22 | ||
23 | import { initConfig } from './controllers/config.js'; | 23 | import { initConfig } from './controllers/config'; |
24 | import { initNativeTheme } from './controllers/nativeTheme.js'; | 24 | import { initNativeTheme } from './controllers/nativeTheme'; |
25 | import { ConfigPersistenceServiceImpl } from './services/impl/ConfigPersistenceServiceImpl.js'; | 25 | import { ConfigPersistenceServiceImpl } from './services/impl/ConfigPersistenceServiceImpl'; |
26 | import { MainStore } from './stores/MainStore.js'; | 26 | import { MainStore } from './stores/MainStore'; |
27 | import { Disposer } from './utils/disposer.js'; | 27 | import { Disposer } from './utils/disposer'; |
28 | 28 | ||
29 | export async function init(store: MainStore): Promise<Disposer> { | 29 | export async function init(store: MainStore): Promise<Disposer> { |
30 | const configPersistenceService = new ConfigPersistenceServiceImpl(app.getPath('userData')); | 30 | const configPersistenceService = new ConfigPersistenceServiceImpl(app.getPath('userData')); |
diff --git a/packages/main/src/controllers/__tests__/config.spec.ts b/packages/main/src/controllers/__tests__/config.spec.ts index eea7f1e..eb67df0 100644 --- a/packages/main/src/controllers/__tests__/config.spec.ts +++ b/packages/main/src/controllers/__tests__/config.spec.ts | |||
@@ -23,10 +23,10 @@ import { mocked } from 'jest-mock'; | |||
23 | import ms from 'ms'; | 23 | import ms from 'ms'; |
24 | 24 | ||
25 | import { initConfig } from '../config'; | 25 | import { initConfig } from '../config'; |
26 | import type { ConfigPersistenceService } from '../../services/ConfigPersistenceService.js'; | 26 | import type { ConfigPersistenceService } from '../../services/ConfigPersistenceService'; |
27 | import { Config, config as configModel } from '../../stores/Config.js'; | 27 | import { Config, config as configModel } from '../../stores/Config'; |
28 | import { Disposer } from '../../utils/disposer.js'; | 28 | import { Disposer } from '../../utils/disposer'; |
29 | import { silenceLogger } from '../../utils/logging.js'; | 29 | import { silenceLogger } from '../../utils/logging'; |
30 | 30 | ||
31 | let config: Config; | 31 | let config: Config; |
32 | let persistenceService: ConfigPersistenceService = { | 32 | let persistenceService: ConfigPersistenceService = { |
diff --git a/packages/main/src/controllers/__tests__/nativeTheme.spec.ts b/packages/main/src/controllers/__tests__/nativeTheme.spec.ts index cffeace..85d6dd2 100644 --- a/packages/main/src/controllers/__tests__/nativeTheme.spec.ts +++ b/packages/main/src/controllers/__tests__/nativeTheme.spec.ts | |||
@@ -21,8 +21,8 @@ | |||
21 | import { jest } from '@jest/globals'; | 21 | import { jest } from '@jest/globals'; |
22 | import { mocked } from 'jest-mock'; | 22 | import { mocked } from 'jest-mock'; |
23 | 23 | ||
24 | import { createMainStore, MainStore } from '../../stores/MainStore.js'; | 24 | import { createMainStore, MainStore } from '../../stores/MainStore'; |
25 | import { Disposer } from '../../utils/disposer.js'; | 25 | import { Disposer } from '../../utils/disposer'; |
26 | 26 | ||
27 | let shouldUseDarkColors = false; | 27 | let shouldUseDarkColors = false; |
28 | 28 | ||
diff --git a/packages/main/src/controllers/config.ts b/packages/main/src/controllers/config.ts index 971f151..deaeac2 100644 --- a/packages/main/src/controllers/config.ts +++ b/packages/main/src/controllers/config.ts | |||
@@ -24,8 +24,8 @@ import { applySnapshot, getSnapshot, onSnapshot } from 'mobx-state-tree'; | |||
24 | 24 | ||
25 | import type { ConfigPersistenceService } from '../services/ConfigPersistenceService.js'; | 25 | import type { ConfigPersistenceService } from '../services/ConfigPersistenceService.js'; |
26 | import type { Config, ConfigSnapshotOut } from '../stores/Config.js'; | 26 | import type { Config, ConfigSnapshotOut } from '../stores/Config.js'; |
27 | import { Disposer } from '../utils/disposer.js'; | 27 | import { Disposer } from '../utils/disposer'; |
28 | import { getLogger } from '../utils/logging.js'; | 28 | import { getLogger } from '../utils/logging'; |
29 | 29 | ||
30 | const DEFAULT_CONFIG_DEBOUNCE_TIME = ms('1s'); | 30 | const DEFAULT_CONFIG_DEBOUNCE_TIME = ms('1s'); |
31 | 31 | ||
diff --git a/packages/main/src/controllers/nativeTheme.ts b/packages/main/src/controllers/nativeTheme.ts index c291a16..ccd12d8 100644 --- a/packages/main/src/controllers/nativeTheme.ts +++ b/packages/main/src/controllers/nativeTheme.ts | |||
@@ -22,8 +22,8 @@ import { nativeTheme } from 'electron'; | |||
22 | import { autorun } from 'mobx'; | 22 | import { autorun } from 'mobx'; |
23 | 23 | ||
24 | import type { MainStore } from '../stores/MainStore.js'; | 24 | import type { MainStore } from '../stores/MainStore.js'; |
25 | import { Disposer } from '../utils/disposer.js'; | 25 | import { Disposer } from '../utils/disposer'; |
26 | import { getLogger } from '../utils/logging.js'; | 26 | import { getLogger } from '../utils/logging'; |
27 | 27 | ||
28 | const log = getLogger('nativeTheme'); | 28 | const log = getLogger('nativeTheme'); |
29 | 29 | ||
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts index 2bdefb8..d0191b7 100644 --- a/packages/main/src/index.ts +++ b/packages/main/src/index.ts | |||
@@ -43,13 +43,13 @@ import { | |||
43 | } from '@sophie/shared'; | 43 | } from '@sophie/shared'; |
44 | import { URL } from 'url'; | 44 | import { URL } from 'url'; |
45 | 45 | ||
46 | import { init } from './compositionRoot.js'; | 46 | import { init } from './compositionRoot'; |
47 | import { | 47 | import { |
48 | DEVMODE_ALLOWED_URL_PREFIXES, | 48 | DEVMODE_ALLOWED_URL_PREFIXES, |
49 | installDevToolsExtensions, | 49 | installDevToolsExtensions, |
50 | openDevToolsWhenReady, | 50 | openDevToolsWhenReady, |
51 | } from './devTools.js'; | 51 | } from './devTools'; |
52 | import { createMainStore } from './stores/MainStore.js'; | 52 | import { createMainStore } from './stores/MainStore'; |
53 | 53 | ||
54 | const isDevelopment = import.meta.env.MODE === 'development'; | 54 | const isDevelopment = import.meta.env.MODE === 'development'; |
55 | 55 | ||
diff --git a/packages/main/src/services/ConfigPersistenceService.ts b/packages/main/src/services/ConfigPersistenceService.ts index 0033cca..aed0ba3 100644 --- a/packages/main/src/services/ConfigPersistenceService.ts +++ b/packages/main/src/services/ConfigPersistenceService.ts | |||
@@ -18,8 +18,8 @@ | |||
18 | * SPDX-License-Identifier: AGPL-3.0-only | 18 | * SPDX-License-Identifier: AGPL-3.0-only |
19 | */ | 19 | */ |
20 | 20 | ||
21 | import type { ConfigSnapshotOut } from '../stores/Config.js'; | 21 | import type { ConfigSnapshotOut } from '../stores/Config'; |
22 | import { Disposer } from '../utils/disposer.js'; | 22 | import { Disposer } from '../utils/disposer'; |
23 | 23 | ||
24 | export type ReadConfigResult = { found: true; data: unknown; } | { found: false; }; | 24 | export type ReadConfigResult = { found: true; data: unknown; } | { found: false; }; |
25 | 25 | ||
diff --git a/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts b/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts index eba291c..2d19632 100644 --- a/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts +++ b/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * Copyright (C) 2021-2022 Kristóf Marussy <kristof@marussy.com> | 2 | * Copyright (C) 2021-2022 Kristóf Marussy <kristof@marussy.com> |
4 | * | 3 | * |
@@ -26,8 +25,8 @@ import { join } from 'path'; | |||
26 | 25 | ||
27 | import type { ConfigPersistenceService, ReadConfigResult } from '../ConfigPersistenceService.js'; | 26 | import type { ConfigPersistenceService, ReadConfigResult } from '../ConfigPersistenceService.js'; |
28 | import type { ConfigSnapshotOut } from '../../stores/Config.js'; | 27 | import type { ConfigSnapshotOut } from '../../stores/Config.js'; |
29 | import { Disposer } from '../../utils/disposer.js'; | 28 | import { Disposer } from '../../utils/disposer'; |
30 | import { getLogger } from '../../utils/logging.js'; | 29 | import { getLogger } from '../../utils/logging'; |
31 | 30 | ||
32 | const log = getLogger('configPersistence'); | 31 | const log = getLogger('configPersistence'); |
33 | 32 | ||
diff --git a/packages/main/src/stores/MainStore.ts b/packages/main/src/stores/MainStore.ts index 9368b4d..f8a09d6 100644 --- a/packages/main/src/stores/MainStore.ts +++ b/packages/main/src/stores/MainStore.ts | |||
@@ -22,7 +22,7 @@ import { applySnapshot, Instance, types } from 'mobx-state-tree'; | |||
22 | import { BrowserViewBounds } from '@sophie/shared'; | 22 | import { BrowserViewBounds } from '@sophie/shared'; |
23 | 23 | ||
24 | import type { Config } from './Config.js'; | 24 | import type { Config } from './Config.js'; |
25 | import { sharedStore } from './SharedStore.js'; | 25 | import { sharedStore } from './SharedStore'; |
26 | 26 | ||
27 | export const mainStore = types.model('MainStore', { | 27 | export const mainStore = types.model('MainStore', { |
28 | browserViewBounds: types.optional(types.model('BrowserViewBounds', { | 28 | browserViewBounds: types.optional(types.model('BrowserViewBounds', { |
diff --git a/packages/main/src/stores/SharedStore.ts b/packages/main/src/stores/SharedStore.ts index 31b8551..e20150d 100644 --- a/packages/main/src/stores/SharedStore.ts +++ b/packages/main/src/stores/SharedStore.ts | |||
@@ -21,7 +21,7 @@ | |||
21 | import { Instance, types } from 'mobx-state-tree'; | 21 | import { Instance, types } from 'mobx-state-tree'; |
22 | import { sharedStore as originalSharedStore } from '@sophie/shared'; | 22 | import { sharedStore as originalSharedStore } from '@sophie/shared'; |
23 | 23 | ||
24 | import { config } from './Config.js'; | 24 | import { config } from './Config'; |
25 | 25 | ||
26 | export type { SharedStoreSnapshotIn, SharedStoreSnapshotOut } from '@sophie/shared'; | 26 | export type { SharedStoreSnapshotIn, SharedStoreSnapshotOut } from '@sophie/shared'; |
27 | 27 | ||