Convert utils/processConfig to TS
Reviewed By: danielbuechele Differential Revision: D16710602 fbshipit-source-id: 3dbccdb0aedd3d5415487d690fb943aafdafa0f0
This commit is contained in:
committed by
Facebook Github Bot
parent
fda506086f
commit
882d7e1a39
@@ -17,7 +17,7 @@ import {exec, spawn} from 'child_process';
|
|||||||
import {remote} from 'electron';
|
import {remote} from 'electron';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {reportPlatformFailures} from '../utils/metrics';
|
import {reportPlatformFailures} from '../utils/metrics';
|
||||||
import config from '../utils/processConfig';
|
import config from '../utils/processConfig.tsx';
|
||||||
import type BaseDevice from '../devices/BaseDevice.tsx';
|
import type BaseDevice from '../devices/BaseDevice.tsx';
|
||||||
|
|
||||||
const CAPTURE_LOCATION = expandTilde(
|
const CAPTURE_LOCATION = expandTilde(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import GK from '../fb-stubs/GK';
|
|||||||
import {FlipperBasePlugin} from '../plugin';
|
import {FlipperBasePlugin} from '../plugin';
|
||||||
import {setupMenuBar} from '../MenuBar.js';
|
import {setupMenuBar} from '../MenuBar.js';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {default as config} from '../utils/processConfig.js';
|
import {default as config} from '../utils/processConfig';
|
||||||
import isProduction from '../utils/isProduction';
|
import isProduction from '../utils/isProduction';
|
||||||
|
|
||||||
export type PluginDefinition = {
|
export type PluginDefinition = {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {persistStore} from 'redux-persist';
|
|||||||
import reducers from './reducers/index.tsx';
|
import reducers from './reducers/index.tsx';
|
||||||
import dispatcher from './dispatcher/index.tsx';
|
import dispatcher from './dispatcher/index.tsx';
|
||||||
import TooltipProvider from './ui/components/TooltipProvider.js';
|
import TooltipProvider from './ui/components/TooltipProvider.js';
|
||||||
import config from './utils/processConfig.js';
|
import config from './utils/processConfig.tsx';
|
||||||
import {stateSanitizer} from './utils/reduxDevToolsConfig.tsx';
|
import {stateSanitizer} from './utils/reduxDevToolsConfig.tsx';
|
||||||
import {initLauncherHooks} from './utils/launcher.js';
|
import {initLauncherHooks} from './utils/launcher.js';
|
||||||
import initCrashReporter from './utils/electronCrashReporter';
|
import initCrashReporter from './utils/electronCrashReporter';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {default as config, resetConfigForTesting} from '../processConfig.js';
|
import {default as config, resetConfigForTesting} from '../processConfig.tsx';
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
resetConfigForTesting();
|
resetConfigForTesting();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {ProcessConfig} from './processConfig.js';
|
import type {ProcessConfig} from './processConfig.tsx';
|
||||||
import type {Store} from '../reducers/index.tsx';
|
import type {Store} from '../reducers/index.tsx';
|
||||||
|
|
||||||
export function initLauncherHooks(config: ProcessConfig, store: Store) {
|
export function initLauncherHooks(config: ProcessConfig, store: Store) {
|
||||||
|
|||||||
@@ -7,23 +7,28 @@
|
|||||||
|
|
||||||
import {remote} from 'electron';
|
import {remote} from 'electron';
|
||||||
|
|
||||||
export type ProcessConfig = {|
|
export type ProcessConfig = {
|
||||||
disabledPlugins: Set<string>,
|
disabledPlugins: Set<string>;
|
||||||
pluginPaths: Array<string>,
|
pluginPaths: Array<string>;
|
||||||
lastWindowPosition: ?{x: number, y: number, width: number, height: number},
|
lastWindowPosition: {
|
||||||
screenCapturePath: ?string,
|
x: number;
|
||||||
launcherMsg: ?string,
|
y: number;
|
||||||
updaterEnabled: boolean,
|
width: number;
|
||||||
|
height: number;
|
||||||
|
} | null;
|
||||||
|
screenCapturePath: string | null;
|
||||||
|
launcherMsg: string | null;
|
||||||
|
updaterEnabled: boolean;
|
||||||
// Controls whether to delegate to the launcher if present.
|
// Controls whether to delegate to the launcher if present.
|
||||||
launcherEnabled: boolean,
|
launcherEnabled: boolean;
|
||||||
|};
|
};
|
||||||
|
|
||||||
let configObj = null;
|
let configObj = null;
|
||||||
export default function config(): ProcessConfig {
|
export default function config(): ProcessConfig {
|
||||||
if (configObj === null) {
|
if (configObj === null) {
|
||||||
const json = JSON.parse(
|
const json = JSON.parse(
|
||||||
// $FlowFixMe: process.env not in type defs
|
// $FlowFixMe: process.env not in type defs
|
||||||
remote?.process.env.CONFIG || process.env.CONFIG || '{}',
|
(remote && remote.process.env.CONFIG) || process.env.CONFIG || '{}',
|
||||||
);
|
);
|
||||||
configObj = {
|
configObj = {
|
||||||
disabledPlugins: new Set(json.disabledPlugins || []),
|
disabledPlugins: new Set(json.disabledPlugins || []),
|
||||||
Reference in New Issue
Block a user