[docs] README section about plugin development
This commit is contained in:
parent
8c9db67b95
commit
068dbdcc7b
45
README.md
45
README.md
|
@ -5,6 +5,7 @@ Modular student club administration system, licensed under the MIT license.
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
```
|
```
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12.22.1",
|
"node": ">= 12.22.1",
|
||||||
|
@ -12,6 +13,7 @@ Modular student club administration system, licensed under the MIT license.
|
||||||
"yarn": ">= 1.21.1"
|
"yarn": ">= 1.21.1"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
So on debian (buster and bullseye) you will need to install node.js and yarn beside the debian packages to meet the needed versions.
|
So on debian (buster and bullseye) you will need to install node.js and yarn beside the debian packages to meet the needed versions.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -23,11 +25,13 @@ npm i -g yarn
|
||||||
npm i -g @quasar/cli
|
npm i -g @quasar/cli
|
||||||
popd
|
popd
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install the dependencies
|
### Install the dependencies
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
Be aware npm might not work.
|
Be aware npm might not work.
|
||||||
|
|
||||||
### Configure Plugins
|
### Configure Plugins
|
||||||
|
@ -41,7 +45,7 @@ The application is using the API of [the backend](https://flaschengeist.dev/Flas
|
||||||
This access needs to be configured in `src/config.ts'->config.baseURL
|
This access needs to be configured in `src/config.ts'->config.baseURL
|
||||||
|
|
||||||
- either you do have a proxy webserver that maps the '/api' to the backend (http://localhost:5000) or
|
- either you do have a proxy webserver that maps the '/api' to the backend (http://localhost:5000) or
|
||||||
- you do directly configure the backend there:```baseURL: 'http://localhost:5000'```. Be aware not committing this configuration.
|
- you do directly configure the backend there:`baseURL: 'http://localhost:5000'`. Be aware not committing this configuration.
|
||||||
|
|
||||||
### Build the application
|
### Build the application
|
||||||
|
|
||||||
|
@ -76,15 +80,36 @@ yarn run lint
|
||||||
|
|
||||||
#### Build a Plugin
|
#### Build a Plugin
|
||||||
|
|
||||||
A Flaschengeist-Frontend-Plugin should be placed in `src/plugins`.
|
Create a new node.js project and add `@flaschengeist/api` as a peer dependency (e.g. `yarn add --peer '@flaschengeist/api'`).
|
||||||
It needs a `plugin.ts` File which exports a plugin with the following interface:
|
If your plugin depends on an other plugin (e.g. you use the `@flaschengeist/users` plugin / stores),
|
||||||
|
then you have to add that plugin as a peer dependency too.
|
||||||
|
|
||||||
```
|
You need to define a main entry point for your plugin (e.g. `"main": "src/index.ts"` in your `package.json`) which exportes
|
||||||
name: string;
|
a plugin descriptor as the default export (see `@flaschengeist/types` -> `FG_Plugin.Plugin`).
|
||||||
mainRoutes?: PluginRouteConfig[];
|
E.g.
|
||||||
outRoutes?: PluginRouteConfig[];
|
|
||||||
requiredModules: string[];
|
```ts
|
||||||
version: string;
|
import { FG_Plugin } from '@flaschengeist/types';
|
||||||
|
import { routes } from './routes';
|
||||||
|
|
||||||
|
const plugin: FG_Plugin.Plugin = {
|
||||||
|
id: 'com.example.myplugin',
|
||||||
|
name: 'myplugin',
|
||||||
|
innerRoutes: routes,
|
||||||
|
// This are required backend plugins:
|
||||||
|
requiredModules: [['auth'], ['users'], ['roles']],
|
||||||
|
version: '0.0.1',
|
||||||
|
widgets: [
|
||||||
|
{
|
||||||
|
priority: 1,
|
||||||
|
name: 'greeting',
|
||||||
|
permissions: [],
|
||||||
|
widget: defineAsyncComponent(() => import('./components/Widget.vue')),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default plugin;
|
||||||
```
|
```
|
||||||
|
|
||||||
You have to import `FG_Plugin` from `plugins.d.ts`.
|
This will add a plugin providing a widget for the dashboard side and some routes.
|
||||||
|
|
Loading…
Reference in New Issue