Releases: aielo/serverless-core-hooks
v0.0.2-3 (pre-release)
Plugin reorganized for an easier and more flexible inherit:
- Most internal logic under
_
methods (e.g._load
) - Other methods are now suitable for override:
activate
configure
load
log
log
method usesthis.config.logPrefix
- if set - as prefix for all messages
super
should be used to preserve default behavior:
...
configure() {
super.configure(); // core hooks configure preserved
// Does not replace this.hooks, merges into it instead
Object.assign(this.hooks, {
"before:serverless:init": this.myHook.bind(this),
});
// Does not replace this.config.core, adds to it instead
this.config.core.push("serverless");
}
...
v0.0.2-2 (pre-release)
serverless-core-hooks can now be extended by other plugins.
This allows plugins to override the configure
method and add core objects directly, with NO need to explicitly set in serverless configuration:
custom.coreHooks.objects
to point out which objects are interceptableserverless-core-hooks
in the plugin section
Plugins should also have serverless-core-hooks as their dependency in package.json
. This prevents projects from having both serverless-core-hooks and the extended plugin as direct dependencies.
v0.0.2-1 (pre-release)
First pre-release.
serverless-core-hooks can be added to projects in the plugin section. When loaded, it will look for custom.coreHooks.objects
in serverless configuration.
Core objects informed will be interceptable and might have core hooks attached to them. The following objects are supported:
cli
pluginManager
serverless
service
utils
variables
yamlParser
Hooks can be added normally, via this.hooks
. Core hooks use the pattern <trigger>:<core-object>:<method>
, for example:
before:serverless:init
after:pluginManager:addPlugin