Socket
Socket
Sign inDemoInstall

bootme

Package Overview
Dependencies
3
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.9 to 0.0.10

38

lib/pipeline.js

@@ -87,3 +87,3 @@ 'use strict'

for (let task of this.registry.tasks) {
for (let task of this.registry.tasks.reverse()) {
try {

@@ -100,2 +100,36 @@ await task.recover(err)

* @param {any} task
* @memberof Task
*/
async bootSubTask(task, state) {
this.registry.addTask(task)
// pass share config
task.config.bootme = this.registry.sharedConfig
// lazy evaluation of task config
if (typeof task.config === 'function') {
const config = await task.config()
task.setConfig(config)
} else {
task.setConfig(task.config)
}
task.addHook('onInit', async state => task.init(state))
await task.executeHooks('onInit', state)
await task.executeHooks('onBefore', state)
const result = await task.action(state)
if (result && typeof task.validateResult === 'function') {
await task.validateResult(result)
}
state.pipeline.results.set(`${task.name}`, result)
await task.executeHooks('onAfter', state)
}
/**
*
*
* @param {any} task
* @memberof Pipeline

@@ -114,2 +148,4 @@ */

task.setConfig(config)
} else {
task.setConfig(task.config)
}

@@ -116,0 +152,0 @@

@@ -45,4 +45,11 @@ 'use strict'

}
const exists = this.tasks.find(t => t.name === task.name)
if (exists) {
throw new Error(`The Task "${task.name}" already exists`)
}
task.addHook('onInit', async state => task.init(state))
task.config.bootme = this.sharedConfig
this.tasks.push(task)

@@ -61,3 +68,3 @@

addHook(taskName, hookName, fn) {
const task = this.tasks.find((t) => t.name === taskName)
const task = this.tasks.find(t => t.name === taskName)

@@ -64,0 +71,0 @@ if (task) {

8

lib/task.js

@@ -53,3 +53,3 @@ 'use strict'

if (result.error) {
error(`Invalid config schema. Task ${this.name}`)
error(`Invalid config schema. Task "${this.name}"`)
throw result.error

@@ -109,3 +109,4 @@ }

throw new TypeError(
`Hook handler of must be a function or Task instance. Task "${this.name}"`
`Hook handler of must be a function or Task instance. Task "${this
.name}"`
)

@@ -153,4 +154,5 @@ }

for (let hook of this[name]) {
// allow passing tasks as hook handlers
if (hook instanceof Task) {
await hook.action(state)
await state.pipeline.bootSubTask(hook, state)
} else {

@@ -157,0 +159,0 @@ await hook.call(this, state)

{
"name": "bootme",
"version": "0.0.9",
"version": "0.0.10",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc