Add --no-updater flag

Summary: Provide a `--no-updater` option that disables the in-app auto updater when passed.

Reviewed By: jknoxville

Differential Revision: D13713919

fbshipit-source-id: 49a647105fea1efa23f653e4a6ed452b3489879b
This commit is contained in:
Pascal Hartig
2019-01-18 07:58:27 -08:00
committed by Facebook Github Bot
parent 87f64c4535
commit 82f4d4ad95
5 changed files with 26 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ function launchElectron({bundleURL, electronURL}) {
const args = [
path.join(STATIC_DIR, 'index.js'),
'--remote-debugging-port=9222',
...process.argv,
];
const proc = child.spawn(electronBinary, args, {

View File

@@ -58,9 +58,6 @@ exports[`Empty app state matches snapshot 1`] = `
<div
className="css-12zzrdt"
/>
<div
className="css-1xcv92o"
/>
<div
className="css-1cecbfb"
onClick={[Function]}

View File

@@ -27,6 +27,7 @@ import DevicesButton from './DevicesButton.js';
import ScreenCaptureButtons from './ScreenCaptureButtons.js';
import AutoUpdateVersion from './AutoUpdateVersion.js';
import config from '../fb-stubs/config.js';
import {isAutoUpdaterEnabled} from '../utils/argvUtils.js';
const AppTitleBar = styled(FlexRow)(({focused}) => ({
background: focused
@@ -65,7 +66,7 @@ class TitleBar extends Component<Props> {
<DevicesButton />
<ScreenCaptureButtons />
<Spacer />
{process.platform === 'darwin' ? <AutoUpdateVersion /> : null}
{isAutoUpdaterEnabled() ? <AutoUpdateVersion /> : null}
{config.bugReportButtonVisible && (
<Button
compact={true}

View File

@@ -0,0 +1,8 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
export const isAutoUpdaterEnabled = false;

15
src/utils/argvUtils.js Normal file
View File

@@ -0,0 +1,15 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import electron from 'electron';
import isProduction from './isProduction';
export const isAutoUpdaterEnabled = () =>
// $FlowFixMe: argv is not included in the type defs.
!electron.remote.process.argv.includes('--no-updater') &&
isProduction() &&
process.platform === 'darwin';