@gasket/plugin-lifecycle
Advanced tools
Comparing version 6.21.0 to 6.24.0
@@ -14,4 +14,4 @@ const debug = require('diagnostics')('gasket:lifecycle'); | ||
*/ | ||
async function resolve(root, name) { | ||
const dir = path.join(root, name); | ||
async function resolve(root, ...parts) { | ||
const dir = path.join(root, ...parts); | ||
@@ -58,7 +58,11 @@ let files = []; | ||
async function init(gasket) { | ||
const lifecycles = await resolve(gasket.config.root, 'lifecycles'); | ||
const lifecycles = await Promise.all([ | ||
resolve(gasket.config.root, 'lifecycles'), | ||
resolve(gasket.config.root, 'src', 'lifecycles') | ||
]); | ||
lifecycles.forEach(function each(cycle) { | ||
gasket.hook(cycle); | ||
}); | ||
lifecycles.reduce((acc, cur) => acc.concat(cur), []) | ||
.forEach(function each(cycle) { | ||
gasket.hook(cycle); | ||
}); | ||
} | ||
@@ -65,0 +69,0 @@ |
{ | ||
"name": "@gasket/plugin-lifecycle", | ||
"version": "6.21.0", | ||
"version": "6.24.0", | ||
"description": "Allows a gasket/ directory to be used for lifecycle hooks in applications.", | ||
@@ -43,3 +43,3 @@ "main": "lib", | ||
"devDependencies": { | ||
"@gasket/engine": "^6.21.0", | ||
"@gasket/engine": "^6.24.0", | ||
"assume": "^2.3.0", | ||
@@ -65,3 +65,3 @@ "eslint": "^8.7.0", | ||
}, | ||
"gitHead": "75eadfdef0630769df2824936ac48e4f5d7c6ba6" | ||
"gitHead": "b2d5e452d54b059398d483787c30087ee02b247a" | ||
} |
@@ -11,3 +11,3 @@ # @gasket/plugin-lifecycle | ||
Create a `lifecycles` folder in the root of your application. This folder should | ||
Create a `lifecycles` (or `src/lifecycles`) folder in the root of your application. This folder should | ||
contain files that can interact with the various of Gasket lifecycles that are | ||
@@ -14,0 +14,0 @@ implemented by the plugins. |
6416
79