Commit Graph

9 Commits

Author SHA1 Message Date
Michel Weststrate
64747dc417 move plugin management from ui-core to server-core
Summary:
Follow up of D32665064, this diff moves all plugin management logic from flipper-ui to flipper-server. Things like downloading, installing, querying new plugins.

Loading plugins is handled separately in the next diff.

Reviewed By: nikoant

Differential Revision: D32666537

fbshipit-source-id: 9786b82987f00180bb26200e38735b334dc4d5c3
2021-12-08 04:30:56 -08:00
Michel Weststrate
e7f841b6d2 Move flipper plugin from flipper-lib types to flipper-common
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.

Reviewed By: nikoant, aigoncharov

Differential Revision: D32665064

fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
2021-12-08 04:30:55 -08:00
Arthur Lee
80feff1615 Fix search by passing query to search request (#2377)
Summary:
When publishing a new flipper plugin, I realized my plugin wasn't showing up in the Plugin Installer search. This was due to a bug where we are only grabbing 50 plugins from NPM and filtering through them locally, instead of passing the search term to the search query. There are 59 plugins that match the keyword filter on npm so 9 plugins never get surfaced.

## Changelog

Fix missing plugins in plugin manager's NPM search

Pull Request resolved: https://github.com/facebook/flipper/pull/2377

Test Plan:
Test the search feature in Plugin Manager

Search for the previously missing package:
![image](https://user-images.githubusercontent.com/1904616/119906244-b4daa580-bf02-11eb-8545-c8cf0663ae92.png)

Previously working searches continue to work:
![image](https://user-images.githubusercontent.com/1904616/119906274-c02dd100-bf02-11eb-938a-d84b27c6bd81.png)

Reviewed By: nikoant

Differential Revision: D28831054

Pulled By: passy

fbshipit-source-id: 84442459cd760c3f593b3df5bb3d89d51852e1c4
2021-06-02 05:47:54 -07:00
Anton Nikolaev
5383017299 Separate interfaces for installed, bundled and downloadable plugins
Summary:
I've re-designed interfaces describing plugins as I found that mental overhead working with them became too expensive because of slightly flawed design. However this cascaded changes in many files so you can see how extensively these interfaces used in our codebase.

Before this change we had one interface PluginDetails which described three different entities: 1) plugins installed on the disk 2) plugins bundled into Flipper 3) plugins available on Marketplace. It's hard to use this "general" PluginDetails interface because of this as you always need to think about all three use cases everywhere.

After this change we have 3 separate interfaces: InstalledPluginDetails, BundledPluginDetails and DownloadablePluginDetails and things became much type-safer now.

Reviewed By: mweststrate

Differential Revision: D25530383

fbshipit-source-id: b93593916a980c04e36dc6ffa168797645a0ff9c
2020-12-15 09:31:57 -08:00
Anton Nikolaev
02d695cb28 Keep multiple installed versions of each plugin
Summary:
This diff changes directory structure for installed plugins to allow installation of multiple versions simultaneously, e.g. to to allow downloading new plugin version while user is still using the previous one, and to have possibility of fast rollback to the previous installed if necessary. The new folder for installed plugins is located in `~/.flipper/installed-plugins` and has the following structure:

  flipper-plugin-reactotron
    1.0.0
      ...
      package.json
    1.0.1
      ...
      package.json
  flipper-plugin-network
    0.67.1
      ...
      package.json
    0.67.2
      ...
      package.json

The tricky part here is that we also need to migrate already installed plugins from the old folder `~/.flipper/thirdparty` to the new folder and maintain the new structure for them.

Another tricky part is that we need to periodically cleanup old versions. For now we will just keep 2 versions of each plugin. Cleanup is performed in background right after Flipper startup.

Reviewed By: mweststrate

Differential Revision: D25393474

fbshipit-source-id: 26617ac26114148f797cc3d6765a42242edc205e
2020-12-15 09:31:54 -08:00
Anton Nikolaev
5b26f36672 Plugin Marketplace API
Summary: Extracted plugin marketplace API to a separate file and updated it to load full plugin manifests.

Reviewed By: passy

Differential Revision: D25181759

fbshipit-source-id: a63f9ce16249ccc170df148cef5c209fdc6d4d6d
2020-12-15 09:31:54 -08:00
Anton Nikolaev
dfbf66408a Fix search by query in Plugin Manager
Summary: I accidently broke search by query in a previous diff, so fixing it here

Reviewed By: passy

Differential Revision: D23842187

fbshipit-source-id: 9fcc7a46048ff99e1bf26c8a70ef0240b38018cb
2020-09-22 10:35:55 -07:00
Anton Nikolaev
75e7261d1e 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
2020-09-16 06:32:58 -07:00
Anton Nikolaev
e48707151a Move the code related to plugin loading / installation to "flipper-plugin-lib"
Summary:
Sorry for so long diff, but actually there are no functional changes, just refactoring to make further changes of Plugin Manager easier to understand.

I've de-coupled the code related to plugin management from UI code and moved it from PluginInstaller UI component (which will be replaced soon by new UI) to "flipper-plugin-lib".  So pretty much everything related to plugin discovery and installation now consolidated in this package.

Additionally, this refactoring enables re-using of plugin management code in "flipper-pkg", e.g. to create CLI command for plugin installation from NPM, e.g.: `flipper-pkg install flipper-plugin-reactotron`.

Reviewed By: passy

Differential Revision: D23679346

fbshipit-source-id: 82e7b9de9afa08c508c1b228c2038b4ba423571c
2020-09-16 06:32:58 -07:00