Disable plugin auto-update in dev mode
Summary: When Flipper is running in dev mode we should always use bundled version of plugin (e.g. loaded from sources) even if a newer version is installed. Otherwise it could happen that Flipper will load installed version and it will not be possible to test your changes of plugin sources. Reviewed By: passy Differential Revision: D22016564 fbshipit-source-id: fbf63d5248b60034dc61688e4faa9b54890b744e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
763853a7cf
commit
74a27aafcc
@@ -51,10 +51,7 @@ export default (store: Store, logger: Logger) => {
|
||||
|
||||
const initialPlugins: Array<
|
||||
typeof FlipperPlugin | typeof FlipperDevicePlugin
|
||||
> = filterNewestVersionOfEachPlugin([
|
||||
...getBundledPlugins(),
|
||||
...getDynamicPlugins(),
|
||||
])
|
||||
> = filterNewestVersionOfEachPlugin(getBundledPlugins(), getDynamicPlugins())
|
||||
.filter(checkDisabled(disabledPlugins))
|
||||
.filter(checkGK(gatekeepedPlugins))
|
||||
.map(requirePlugin(failedPlugins, defaultPluginsIndex))
|
||||
@@ -80,13 +77,18 @@ export default (store: Store, logger: Logger) => {
|
||||
};
|
||||
|
||||
export function filterNewestVersionOfEachPlugin(
|
||||
plugins: PluginDetails[],
|
||||
bundledPlugins: PluginDetails[],
|
||||
dynamicPlugins: PluginDetails[],
|
||||
): PluginDetails[] {
|
||||
const pluginByName: {[key: string]: PluginDetails} = {};
|
||||
for (const plugin of plugins) {
|
||||
for (const plugin of bundledPlugins) {
|
||||
pluginByName[plugin.name] = plugin;
|
||||
}
|
||||
for (const plugin of dynamicPlugins) {
|
||||
if (
|
||||
!pluginByName[plugin.name] ||
|
||||
semver.gt(plugin.version, pluginByName[plugin.name].version, true)
|
||||
(!process.env.FLIPPER_DISABLE_PLUGIN_AUTO_UPDATE &&
|
||||
semver.gt(plugin.version, pluginByName[plugin.name].version, true))
|
||||
) {
|
||||
pluginByName[plugin.name] = plugin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user