diff --git a/app/src/shell/index.js b/app/src/shell/index.js index ebcedd826d7..caafae8218d 100644 --- a/app/src/shell/index.js +++ b/app/src/shell/index.js @@ -24,7 +24,7 @@ import type { import type { ViewableRobot } from '../discovery' import type { ShellState } from './types' -const { ipcRenderer } = remote +const { ipcRenderer, CURRENT_VERSION, CURRENT_RELEASE_NOTES } = remote const log = createLogger(__filename) @@ -32,14 +32,7 @@ export * from './update' export * from './buildroot' export * from './types' -const CURRENT_VERSION: string = remote.CURRENT_VERSION -const CURRENT_RELEASE_NOTES: string = remote.CURRENT_RELEASE_NOTES -const API_RELEASE_NOTES = CURRENT_RELEASE_NOTES.replace( - /([\S\s]*?)/, - '' -) - -export { CURRENT_VERSION, CURRENT_RELEASE_NOTES, API_RELEASE_NOTES } +export { CURRENT_VERSION, CURRENT_RELEASE_NOTES } export const shellReducer: Reducer = combineReducers< _, diff --git a/app/src/shell/remote.js b/app/src/shell/remote.js index eb4eadb96ff..c4175b6086e 100644 --- a/app/src/shell/remote.js +++ b/app/src/shell/remote.js @@ -2,19 +2,21 @@ // access main process remote modules via attachments to `global` import assert from 'assert' -assert( - global.APP_SHELL_REMOTE, - 'Expected APP_SHELL_REMOTE to be attached to global scope; is app-shell/src/preload.js properly configured?' -) +import type { Remote } from './types' -const remote = new Proxy(global.APP_SHELL_REMOTE, { +const remote = new Proxy((({}: any): Remote), { get(target, propName) { assert( - propName in target, + global.APP_SHELL_REMOTE, + 'Expected APP_SHELL_REMOTE to be attached to global scope; is app-shell/src/preload.js properly configured?' + ) + + assert( + propName in global.APP_SHELL_REMOTE, `Expected APP_SHELL_REMOTE.${propName} to exist, is app-shell/src/preload.js properly configured?` ) - return target[propName] + return global.APP_SHELL_REMOTE[propName] }, }) diff --git a/app/src/shell/types.js b/app/src/shell/types.js index 1c420ffe97e..3ecd56502f7 100644 --- a/app/src/shell/types.js +++ b/app/src/shell/types.js @@ -1,7 +1,17 @@ // @flow +import type { Service } from '@opentrons/discovery-client' +import type { Config } from '../config/types' import type { BuildrootState, BuildrootAction } from './buildroot/types' import type { ShellUpdateState, ShellUpdateAction } from './update' +export type Remote = {| + ipcRenderer: {| send: (string, ...args: Array) => void |}, + CURRENT_VERSION: string, + CURRENT_RELEASE_NOTES: string, + INITIAL_CONFIG: Config, + INITIAL_ROBOTS: Array, +|} + export type ShellState = {| update: ShellUpdateState, buildroot: BuildrootState,