From 78510c35f7c017d8e805e7f8bcf8b12df14835cd Mon Sep 17 00:00:00 2001 From: ferfissimo Date: Wed, 26 May 2021 19:06:19 +0000 Subject: [PATCH] run a plugin --- Development%2FFrontend.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Development%2FFrontend.md b/Development%2FFrontend.md index 35d4b98..c61a801 100644 --- a/Development%2FFrontend.md +++ b/Development%2FFrontend.md @@ -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),