isPluginCompatible for flipper-server-core
Summary: Yet another implementation of this function. References: https://www.internalfb.com/code/fbsource/[85c1fe5afee7]/xplat/sonar/desktop/flipper-frontend-core/src/utils/isPluginCompatible.tsx?lines=14 https://www.internalfb.com/code/fbsource/[85c1fe5afee7]/xplat/sonar/desktop/flipper-ui-core/src/utils/isPluginCompatible.tsx?lines=15 This one: - Uses GK from the existing server config - Gets version from the existing server config It differs in: - appVersion not passed in as argument - Doesn't use RenderHost to obtain the server config I think, this is acceptable as the function body is effectively the conditional, that depends on the caller available dependencies. Reviewed By: passy Differential Revision: D37749761 fbshipit-source-id: 3094e87c7770ac66e5764c932a0a0d4e7f5b63f5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5551cf3bb2
commit
ff66cd18ec
@@ -37,6 +37,7 @@
|
||||
"rsocket-flowable": "^0.0.27",
|
||||
"rsocket-tcp-server": "^0.0.25",
|
||||
"rsocket-types": "^0.0.25",
|
||||
"semver": "^7.3.7",
|
||||
"serialize-error": "^8.1.0",
|
||||
"split2": "^4.1.0",
|
||||
"tmp": "^0.2.1",
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {PluginDetails} from 'flipper-common';
|
||||
import semver from 'semver';
|
||||
import {getFlipperServerConfig} from '../FlipperServerConfig';
|
||||
|
||||
export function isPluginCompatible(plugin: PluginDetails) {
|
||||
const config = getFlipperServerConfig();
|
||||
const flipperVersion = config.environmentInfo.appVersion;
|
||||
return (
|
||||
config.gatekeepers['flipper_disable_plugin_compatibility_checks'] ||
|
||||
flipperVersion === '0.0.0' ||
|
||||
!plugin.engines?.flipper ||
|
||||
semver.lte(plugin.engines?.flipper, flipperVersion)
|
||||
);
|
||||
}
|
||||
|
||||
export default isPluginCompatible;
|
||||
Reference in New Issue
Block a user