@factorialco/shadowdog
Advanced tools
Comparing version 0.7.1 to 0.7.2
{ | ||
"name": "@factorialco/shadowdog", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -42,3 +42,3 @@ #!/usr/bin/env node | ||
try { | ||
await (0, generate_1.generate)(config, eventEmitter); | ||
await (0, generate_1.generate)(config, eventEmitter, { continueOnError: watch }); | ||
} | ||
@@ -45,0 +45,0 @@ catch (error) { |
@@ -21,3 +21,6 @@ import { CommandConfig, ConfigFile, InvalidatorConfig } from './config'; | ||
} | ||
export declare const generate: (config: ConfigFile, eventEmitter: ShadowdogEventEmitter) => Promise<unknown>; | ||
interface GenerateOptions { | ||
continueOnError: boolean; | ||
} | ||
export declare const generate: (config: ConfigFile, eventEmitter: ShadowdogEventEmitter, options: GenerateOptions) => Promise<unknown>; | ||
export {}; |
@@ -11,10 +11,10 @@ "use strict"; | ||
const tasks_1 = require("./tasks"); | ||
const processTask = async (task, pluginsConfig, eventEmitter) => { | ||
const processTask = async (task, pluginsConfig, eventEmitter, options) => { | ||
switch (task.type) { | ||
case 'parallel': { | ||
return Promise.all(task.tasks.map((subTask) => processTask(subTask, pluginsConfig, eventEmitter))); | ||
return Promise.all(task.tasks.map((subTask) => processTask(subTask, pluginsConfig, eventEmitter, options))); | ||
} | ||
case 'serial': { | ||
for (const subTask of task.tasks) { | ||
await processTask(subTask, pluginsConfig, eventEmitter); | ||
await processTask(subTask, pluginsConfig, eventEmitter, options); | ||
} | ||
@@ -33,4 +33,4 @@ return; | ||
}); | ||
(0, plugins_1.filterMiddlewarePlugins)(pluginsConfig).forEach(({ fn, options }) => { | ||
taskRunner.use(fn.middleware, options); | ||
(0, plugins_1.filterMiddlewarePlugins)(pluginsConfig).forEach(({ fn, options: pluginOptions }) => { | ||
taskRunner.use(fn.middleware, pluginOptions); | ||
}); | ||
@@ -56,3 +56,5 @@ taskRunner.use(() => { | ||
}); | ||
throw error; | ||
if (!options.continueOnError) { | ||
throw error; | ||
} | ||
} | ||
@@ -66,3 +68,3 @@ break; | ||
}; | ||
const generate = async (config, eventEmitter) => { | ||
const generate = async (config, eventEmitter, options) => { | ||
const plugins = (0, plugins_1.filterCommandPlugins)(config.plugins); | ||
@@ -79,4 +81,4 @@ const task = { | ||
const finalTask = plugins.reduce((subTask, { fn }) => fn.command(subTask), task); | ||
return processTask(finalTask, config.plugins, eventEmitter); | ||
return processTask(finalTask, config.plugins, eventEmitter, options); | ||
}; | ||
exports.generate = generate; |
{ | ||
"name": "@factorialco/shadowdog", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "bin": { |
278202
3823