run a plugin

ferfissimo 2021-05-26 19:06:19 +00:00
parent 262fa23705
commit 78510c35f7
1 changed files with 29 additions and 1 deletions

@ -31,8 +31,36 @@ yarn lint
```
## Plugins
### Run and test a plugin
There must be only one `@flaschengeist/api` instance! If there are more, some hard to debug error might occur.
#### Build a Plugin
So if you want to test your plugin while developing, you have to link it into your `flaschengeist` instance.
To do so run the following commands:
```sh
# Inside your flaschengeist project (let's say you cloned the frontend to ./flaschengeist)
# cd flaschengeist/node_modules/@flaschengeist/api
yarn link
# Inside your plugin directory
# cd your-flaschengeist-plugin
yarn link '@flaschengeist/api'
yarn link
# Back inside your flaschengeist dir
# cd flaschengeist
yarn link '@flaschengeist/your-plugin'
```
So now you have created a link from your plugin to the `@flaschengeist/api` used by `flaschengeist`.
And a link from `flaschengeist` to your plugin.
That means `flaschengeist` uses your plugin and your plugin uses the same api as `flaschengeist`.
### Build a Plugin
Create a new node.js project and add `@flaschengeist/api` as a peer dependency (e.g. `yarn add --peer '@flaschengeist/api'`).
If your plugin depends on an other plugin (e.g. you use the `@flaschengeist/users` plugin / stores),