2.0.2 • Published 5 years ago
hemera-plugin v2.0.2
Hemera-plugin package
hemera-plugin
is a plugin helper for Hemera.
Usage
hemera-plugin
can do some things for you:
- Check the bare-minimum version of Hemera
- Provide consistent interface to register plugins even when the api is changed
- Pass metadata to intialize your plugin with correct dependencies, default options and name.
const hp = require('hemera-plugin')
module.exports = hp(function(hemera, opts, next) {
next()
})
If you need to set a bare-minimum version of Hemera for your plugin, just add the semver range that you need:
const hp = require('hemera-plugin')
module.exports = hp(function(hemera, opts, next) {
next()
}, '0.x')
You can check here how to define a semver
range.
Async / Await
const hp = require('hemera-plugin')
module.exports = hp(async function(hemera, opts) {
// your plugin code
}, '0.x')
You can also pass some metadata that will be handled by Hemera, such as the dependencies, default options and the name of your plugin.
const hp = require('hemera-plugin')
function plugin(hemera, opts, next) {
// your plugin code
next()
}
module.exports = hp(plugin, {
hemera: '0.x', // bare-minimum version of Hemera
name: 'my-plugin', // name of your plugin, will be used e.g for logging purposes
scoped: false, // when false no hemera plugin is created. This is useful if you want to extend the core but don't need a seperate plugin scope.
options: { host: 'localhost', port: 8003 }, // default options for your plugin
// Plugin dependencies
decorators: ['joi'],
dependencies: ['plugin2']
})
Credits
2.0.2
5 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.3.3
6 years ago
1.3.2
6 years ago
1.3.1
6 years ago
1.3.0
7 years ago
1.2.0
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.0
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.17
7 years ago
0.0.16
7 years ago
0.0.15
7 years ago
0.0.14
7 years ago
0.0.13
7 years ago
0.0.12
7 years ago
0.0.11
8 years ago
0.0.10
8 years ago
0.0.9
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4
8 years ago
0.0.3
8 years ago
0.0.2
8 years ago
0.0.1
8 years ago