Remove support for plugin format v1

Summary:
Do not list plugins packaged with format v1 in Plugin Manager.

Changelog: removed support for plugins packaged using legacy format (v1), so they won't appear in Plugin Manager anymore.

Reviewed By: passy

Differential Revision: D23681402

fbshipit-source-id: 1c9496ba6b739069d67228a0f4250f2f01aabd4d
This commit is contained in:
Anton Nikolaev
2020-09-16 06:30:20 -07:00
committed by Facebook GitHub Bot
parent e48707151a
commit 75e7261d1e
3 changed files with 6 additions and 90 deletions

View File

@@ -20,7 +20,7 @@ import {
addDisabledPlugins,
addFailedPlugins,
} from '../reducers/plugins';
import {ipcRenderer, shell} from 'electron';
import {ipcRenderer} from 'electron';
import GK from '../fb-stubs/GK';
import {FlipperBasePlugin} from '../plugin';
import {setupMenuBar} from '../MenuBar';
@@ -31,8 +31,6 @@ import {notNull} from '../utils/typeUtils';
import {sideEffect} from '../utils/sideEffect';
import semver from 'semver';
import {PluginDetails} from 'flipper-plugin-lib';
import {addNotification} from '../reducers/notifications';
import styled from '@emotion/styled';
import {tryCatchReportPluginFailures, reportUsage} from '../utils/metrics';
import * as FlipperPluginSDK from 'flipper-plugin';
import Immer from 'immer';
@@ -41,10 +39,6 @@ import Immer from 'immer';
import getPluginIndex from '../utils/getDefaultPluginsIndex';
import {SandyPluginDefinition} from 'flipper-plugin';
const Paragraph = styled.p({
marginBottom: '0.1em',
});
export default (store: Store, logger: Logger) => {
// expose Flipper and exact globally for dynamically loaded plugins
const globalObject: any = typeof window === 'undefined' ? global : window;
@@ -75,72 +69,6 @@ export default (store: Store, logger: Logger) => {
store.dispatch(addDisabledPlugins(disabledPlugins));
store.dispatch(addFailedPlugins(failedPlugins));
store.dispatch(registerPlugins(initialPlugins));
const deprecatedSpecPlugins = initialPlugins.filter(
(p) => !p.isDefault && p.details.specVersion === 1,
);
for (const plugin of deprecatedSpecPlugins) {
store.dispatch(
addNotification({
pluginId: plugin.id,
client: null,
notification: {
id: `plugin-spec-v1-deprecation-${plugin.packageName}`,
title: `Plugin "${plugin.title}" will stop working after version 0.48 of Flipper released, because it is packaged using the deprecated format.`,
message: (
<>
<Paragraph>
Please try to install a newer version of this plugin packaged
using "Install Plugins" tab on "Manage Plugins" form.
</Paragraph>
<Paragraph>
If the latest version of the plugin is still packaged in the old
format, please contact the author and consider raising a pull
request for upgrading the plugin. You can find contact details
on the package page&nbsp;
<a
href={`#`}
onClick={() =>
shell.openExternal(
`https://www.npmjs.com/package/${plugin.packageName}`,
)
}>
https://www.npmjs.com/package/{plugin.packageName}
</a>
.
</Paragraph>
<Paragraph>
If you are the author of this plugin, please migrate your plugin
to the new format, and publish new version of it. See&nbsp;
<a
href={`#`}
onClick={() =>
shell.openExternal(
'https://fbflipper.com/docs/extending/js-setup#migration-to-the-new-plugin-specification',
)
}>
https://fbflipper.com/docs/extending/js-setup#migration-to-the-new-plugin-specification
</a>
&nbsp;on how to migrate the plugin. See&nbsp;
<a
href={`#`}
onClick={() =>
shell.openExternal(
'https://fbflipper.com/docs/extending/js-setup#package-format',
)
}>
https://fbflipper.com/docs/extending/js-setup#package-format
</a>
&nbsp;for details on plugin package format.
</Paragraph>
</>
),
severity: 'error',
timestamp: Date.now(),
category: `Plugin Spec V1 Deprecation`,
},
}),
);
}
sideEffect(
store,