Restructured dev workflow docs
Summary: This diff unifies setup and workflow information that was scattered a bit around into one cohesive 'Development workflow' subsection in the 'creating plugins' section of Flipper. Reviewed By: nikoant Differential Revision: D25612288 fbshipit-source-id: 5fa7f2d000fb7ab3e1b5c5a4fc8cc1f209252f41
This commit is contained in:
committed by
Facebook GitHub Bot
parent
19ea20511c
commit
69dae5c8e5
@@ -48,45 +48,7 @@ $ npx flipper-pkg init
|
||||
|
||||
The tool will ask you to provide "id" and "title" for your plugin. Use "sea-mammals" as "id" and "Sea Mammals" as "title". After that the tool will create two files in the directory: `package.json` and `src/index.tsx`.
|
||||
|
||||
Open the `package.json` to check the fields:
|
||||
|
||||
1. "$schema" must contain URI identifying scheme according to which the plugin is defined. Currently, Flipper supports plugins defined by the specification version 2 (https://fbflipper.com/schemas/plugin-package/v2.json), while version 1 is being deprecated.
|
||||
2. "name" must start with "flipper-plugin-"
|
||||
3. "keywords" must contain "flipper-plugin"
|
||||
4. "id" must be the same as used on native side, e.g. returned by getId() method in Android plugin. In our case that is "sea-mammals".
|
||||
5. "flipperBundlerEntry" must point to the source entry point which will be used by "flipper-pkg" to produce the plugin bundle.
|
||||
6. "main" must point to the place where the produced bundle will be written.
|
||||
7. "title" and "icon" are optional fields specifying the plugin item appearance in the Flipper sidebar.
|
||||
|
||||
For instance:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://fbflipper.com/schemas/plugin-package/v2.json",
|
||||
"name": "flipper-plugin-sea-mammals",
|
||||
"id": "sea-mammals",
|
||||
"version": "2.0.0",
|
||||
"main": "dist/bundle.js",
|
||||
"flipperBundlerEntry": "src/index.tsx",
|
||||
"license": "MIT",
|
||||
"keywords": ["flipper-plugin"],
|
||||
"icon": "apps",
|
||||
"title": "Sea Mammals",
|
||||
"category": "Example Plugin",
|
||||
"scripts": {
|
||||
"lint": "flipper-pkg lint",
|
||||
"prepack": "flipper-pkg lint && flipper-pkg bundle"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"flipper": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"flipper": "latest",
|
||||
"flipper-pkg": "latest"
|
||||
}
|
||||
}
|
||||
```
|
||||
*See [package.json](https://github.com/facebook/flipper/blob/master/desktop/plugins/seamammals/package.json)*
|
||||
See [package.json](https://github.com/facebook/flipper/blob/master/desktop/plugins/seamammals/package.json) for an example.
|
||||
|
||||
To ensure there are no errors in the defined plugin, install packages (using `yarn install` or `npm install`) and execute script `lint` (`yarn lint` or `npm run lint`) which shows all the mismatches that should be fixed to make the plugin definition valid.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user