Commit Graph

8 Commits

Author SHA1 Message Date
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
Michel Weststrate
f7732ed4fd Insert a proper flipper-plugin version
Summary:
`flipper-pkg init` would always introduce `flipper-plugin` peer with version `latest`. Since that can never be checked against the current flipper version, it always generated a warning. Updated the init process to take the version the plugin was generated with as base version instead.

Note that in the test the version will always display as 0.0.0, will double check after release that the proper version will show up when running from npx, but don't see a reason why not (famous last words)

Reviewed By: nikoant, priteshrnandgaonkar

Differential Revision: D28992531

fbshipit-source-id: c32aad1650f575f790c2e04d089104b7a616d26f
2021-06-10 04:45:18 -07:00
Anton Nikolaev
68248a7c63 Device plugin management (4/n): Allow choosing "device" plugin type in "flipper-pkg init"
Summary:
Added option to bootstrap device plugin in "flipper-pkg".

Changelog: "flipper-pkg init" can now be used to bootstrap device plugins

Reviewed By: mweststrate

Differential Revision: D26389429

fbshipit-source-id: 90773011bd50289004cd747111e1787402840922
2021-02-16 10:50:19 -08:00
Lukas Kurucz
f2996b7e7c When init, search for first level subdirectory (#1269)
Summary:
When running `flipper-pkg init path/plugin`, this allows to skip the `Do you wanna add this path to watching in Flipper config?`, if the path is direct first level subdirectory of any added path from Flipper `pluginPaths: []`

## Changelog

- Improve matching for watched pluginPaths when initialising new plugin
Pull Request resolved: https://github.com/facebook/flipper/pull/1269

Test Plan:
1. Create folder: `~/flipper-plugins`
2. Add this folder to Flipper config `pluginPaths: ['~/flipper-plugins']`
3. Create new subfolder `test-plugin`
4. Run `flipper-pkg init test-plugin`
5. It should not ask to add this folder to pluginPaths

To verify it only works for first level subdirectory, create another folder: `/deep/test-plugin2` and re-run steps with it.

This should also keep working if we specify exactly the path for the plugin itself.

Reviewed By: mweststrate

Differential Revision: D22065630

Pulled By: jknoxville

fbshipit-source-id: 9ef8d364e3815033b63579e37a6f2d19515ca902
2020-06-16 04:50:45 -07:00
Michel Weststrate
d103c218d2 automatically plugin directory to Flipper config on init
Summary: Freshly init-ed plugins are not picked up by Flipper if they are not on the search path. This diff checks if the current dir is on the search path, and, if not, suggests to add it.

Reviewed By: jknoxville

Differential Revision: D21619632

fbshipit-source-id: b1dbe2695dbee9ce537999dc83e36f969ba4b747
2020-05-19 05:33:35 -07:00
Michel Weststrate
49b4022228 added tests for generated template files
Summary:
Created a test that snapshots the generated files, so that we can capture accidental regressions when generating files.

Also made the package id to package name a bit more robust

Reviewed By: jknoxville

Differential Revision: D21619633

fbshipit-source-id: 88ffb127e050d840df9ccd4b15ba29a71f341975
2020-05-19 05:33:35 -07:00
Michel Weststrate
3f86c9f6d2 init should always create a directory
Summary:
Although there are tools that do this for you (create-react-app, react-native), and other that assume you are already in the created directory before you invoke the command (typescript, git), creating the directory by the tool has a few benefits:

1. less risk of making an accidental mess when people assume they don't need to create the dir first (I definitely ended up with a node_modules in the wrong directory)
1. it provide a naive way of detecting plugin name conflicts early (at least for plugins you create yourself)
1. in the next diff I'll add a pkg suggestion to add the current directory to the search path for flipper plugins. In the current setup, that would require needing to suggest to add the parent directory, which somehow feels less logical
2. makes sure that the directory name follows npm conventions: the package.json name should match the current directory name (not super important, but e.g VSCode will show warnings otherwise)

Reviewed By: jknoxville

Differential Revision: D21619631

fbshipit-source-id: 6d027ad18f14659e0347a66cacf056eacbc65680
2020-05-19 05:33:35 -07:00
Anton Nikolaev
d08dfee018 "init" command for flipper-pkg tool
Summary: Added command "init" to "flipper-pkg" which helps to quickly initialise Flipper desktop plugin.

Reviewed By: passy

Differential Revision: D21253819

fbshipit-source-id: 85a2fbde07ecb63737d180d2a7e5cc2846b4f533
2020-04-27 17:34:12 -07:00