Clean up process globals
Summary: Cleaned up some `process` references Reviewed By: passy Differential Revision: D33184882 fbshipit-source-id: 6fc56bcea4e145ba97aa8bf9e689e53e2bf239cc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e46fcba0b2
commit
4630f37786
@@ -20,6 +20,7 @@ export * from './server-types';
|
||||
export {sleep} from './utils/sleep';
|
||||
export {timeout} from './utils/timeout';
|
||||
export {isTest} from './utils/isTest';
|
||||
export {isProduction} from './utils/isProduction';
|
||||
export {assertNever} from './utils/assertNever';
|
||||
export {fsConstants} from './utils/fsConstants';
|
||||
export {
|
||||
|
||||
18
desktop/flipper-common/src/utils/isProduction.tsx
Normal file
18
desktop/flipper-common/src/utils/isProduction.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare const process: any;
|
||||
|
||||
// TODO: there are currently two definitions of isProduction active,
|
||||
// this one, and one provided by the RenderHostConfig. Ideally they should be unified
|
||||
export function isProduction(): boolean {
|
||||
return (
|
||||
typeof process === 'undefined' || process.env.NODE_ENV === 'production'
|
||||
);
|
||||
}
|
||||
@@ -8,8 +8,7 @@
|
||||
*/
|
||||
|
||||
declare const process: any;
|
||||
const _isTest = typeof process !== 'undefined' && !!process.env.JEST_WORKER_ID;
|
||||
|
||||
export function isTest(): boolean {
|
||||
return _isTest;
|
||||
return typeof process !== 'undefined' && !!process.env.JEST_WORKER_ID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user