node-pluginsmanager
v3.8.0
Published
A plugins manager.
Readme
node-pluginsmanager
A plugins manager
please note that this version is only usable with node-pluginsmanager-plugin 3.x.x && 4.x.x
Installation
$ npm install node-pluginsmanagerFeatures
- simply manage plugins (extended from node-pluginsmanager-plugin) to interact with specifics hardwares / API / whatever
- install plugins manually or via github & initialize them
- load external plugins from absolute directories (outside the plugins directory)
- update plugins via github
- uninstall plugins and release there resources
- run plugins' middlewares for server, to create specifics rules
- check plugins' modules' versions
Architecture
Plugin

Routes

Content
check the TypeScript definition file
Events
on("error", (err: Error) => void) : thisfires if an error occurson("loading", (pluginName: string, ...unknown[]) => void) : thisfires if a plugin starts loadon("loaded", (plugin: Orchestrator, ...unknown[]) => void) : thisfires if a plugin ends loadon("allloaded", (...unknown[]) => void) : thisfires if all the plugins are loadedon("initializing", (plugin: Orchestrator, ...unknown[]) => void) : thisfires if a plugin starts initon("initialized", (plugin: Orchestrator, ...unknown[]) => void) : thisfires if a plugin ends initon("allinitialized", (...unknown[]) => void) : thisfires if all the plugins are initializedon("released", (plugin: Orchestrator, ...unknown[]) => void) : thisfires if a plugin is releasedon("allreleased", (...unknown[]) => void) : thisfires if all the plugins are releasedon("destroyed", (pluginName: string, ...unknown[]) => void) : thisfires if a plugin is destroyedon("alldestroyed", (...unknown[]) => void) : thisfires if all the plugins are destroyedon("installing", (pluginName: string, currentStep: number, maxSteps: number, stepDescription: string, ...unknown[]) => void) : thisfires with plugin installation progresson("installed", (plugin: Orchestrator, ...unknown[]) => void) : thisfires if a plugin is installedon("updating", (pluginName: string, currentStep: number, maxSteps: number, stepDescription: string, ...unknown[]) => void) : thisfires with plugin update progresson("updated", (plugin: Orchestrator, ...unknown[]) => void) : thisfires if a plugin is updatedon("uninstalled", (pluginName: string, ...unknown[]) => void) : thisfires if a plugin is uninstalled
External plugins
External plugins are loaded from absolute directories registered before loadAll(). They are added to plugins and initialized like local plugins, but cannot be updated or uninstalled by the manager.
import { join } from "node:path";
import PluginsManager from "node-pluginsmanager";
const manager = new PluginsManager({
"directory": "/path/to/local/plugins",
"externalResourcesDirectory": "/path/to/resources"
});
await manager.addExternalPluginDirectory("/path/to/external/my-plugin");
await manager.setOrder([ "my-plugin", "other-plugin" ]); // optional
await manager.loadAll();
await manager.initAll();Rules:
- each path must be an absolute directory pointing to a plugin root
- registration must happen before
loadAll() - a plugin name cannot exist both locally and externally
- external plugins cannot be updated (
updateViaGithub) or uninstalled (uninstall) releaseAll()anddestroyAll()still apply to external plugins
Examples
check the TypeScript compilation tests
Tests
$ git clone git://github.com/Psychopoulet/node-pluginsmanager.git
$ cd ./node-pluginsmanager
$ npm install
$ npm run-script tests