Skip to content

Implement the Plugin system #2

@YannickFricke

Description

@YannickFricke

Botvy Plugin System

Description

The Botvy plugin system loads plugins from different data sources.

Every developer is welcome to append their own data source for loading different type of modules!.
Maybe the project will be open sourced so everyone else could use the data source.

UI

Requirements

Expose the extended definitions

The UI package must export the extended definitions for the window global. It should expose React for the plugins which can then import it from the window.React variable.

Loading external components for sections

The UI should be able to import external components for different parts of the sections.

React.js must be added as peer dependency to the plugin since it is already provided by the plugin system!

For this the NodeJSRequirer should be used to require the correct files.

Dependencies

  • react
  • @types/react
  • inversify
  • fs (maybe an abstraction?)
  • @types/node
  • typescript
  • webpack
  • css-loader
  • html-webpack-plugin

Client

Requirements

Loading external Plugins

The electron client should be able to load plugins based on a configuration file (plugin.json). This JSON file is validated against a JSON schema which must also be defined by the Plugin System.

The PluginManager should use the generic class "DataLoader"s which load the plugins from different data sources. The "DataLoader" class is injectable by inversify for providing dependency injection for the plugins.

The DataLoader could use the NodeJSRequirer to load plugins from a file based system.

  • UI
    • Expose window.React definitions
    • Theming support
    • Load external components for different sections
      • Use the TypeScript transpiler to transform the source code into JavaScript code
        • Write a custom TypeScript transformer which replaces the imports (import React from 'react') to const React = window.React;
      • Load the files for the section manager (via the client (electron hook))
      • Add react as peer dependency
    • provide custom hooks
      • using the IPC-Handler
      • using the section manager
        • registering new components for a specific section
        • fetching the registered components for the given section
      • using the electron client
        • minimize
        • maximize
        • windowed
        • closing the browser windows
  • Client
    • Load external plugins
      • Load external container modules
      • Execute the plugin lifecycle hooks
    • Register event handlers using plugins
    • Register new IPC-Handler using plugins

Problems

The plugins must be transpiled by the TypeScript transpiler to have the correct output!

All output modes which are provided by webpack are NOT COMPATIBLE to this kind of loading plugins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clientAll client related issuesenhancementNew feature or requestuiAll UI related issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions