style: xo
This commit is contained in:
@@ -53,7 +53,7 @@ module.exports = (context, pluginsPath) => {
|
||||
} else {
|
||||
// If an object is passed and the path is missing, merge it with step options
|
||||
if (isPlainObject(options[type]) && !options[type].path) {
|
||||
options[type] = castArray(plugins[type]).map(plugin =>
|
||||
options[type] = castArray(plugins[type]).map((plugin) =>
|
||||
plugin ? [plugin[0], Object.assign(plugin[1], options[type])] : plugin
|
||||
);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ module.exports = (context, pluginsPath) => {
|
||||
pluginOptions = options[type];
|
||||
}
|
||||
|
||||
const steps = castArray(pluginOptions).map(pluginOpt =>
|
||||
const steps = castArray(pluginOptions).map((pluginOpt) =>
|
||||
normalize(
|
||||
{...context, options: omit(options, Object.keys(PLUGINS_DEFINITIONS), 'plugins')},
|
||||
type,
|
||||
@@ -75,7 +75,7 @@ module.exports = (context, pluginsPath) => {
|
||||
)
|
||||
);
|
||||
|
||||
pluginsConf[type] = async input =>
|
||||
pluginsConf[type] = async (input) =>
|
||||
postprocess(
|
||||
await pipeline(steps, pipelineConfig && pipelineConfig(pluginsConf, logger))(await preprocess(input)),
|
||||
input
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
throw getError('EPLUGIN', {type, pluginName});
|
||||
}
|
||||
|
||||
const validator = async input => {
|
||||
const validator = async (input) => {
|
||||
const {dryRun, outputValidator} = PLUGINS_DEFINITIONS[type] || {};
|
||||
try {
|
||||
if (!input.options.dryRun || dryRun) {
|
||||
@@ -48,7 +48,7 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
logger.warn(`Skip step "${type}" of plugin "${pluginName}" in dry-run mode`);
|
||||
} catch (error) {
|
||||
logger.error(`Failed step "${type}" of plugin "${pluginName}"`);
|
||||
extractErrors(error).forEach(err => Object.assign(err, {pluginName}));
|
||||
extractErrors(error).forEach((err) => Object.assign(err, {pluginName}));
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ const {extractErrors} = require('../utils');
|
||||
*
|
||||
* @return {Pipeline} A Function that execute the `steps` sequencially
|
||||
*/
|
||||
module.exports = (steps, {settleAll = false, getNextInput = identity, transform = identity} = {}) => async input => {
|
||||
module.exports = (steps, {settleAll = false, getNextInput = identity, transform = identity} = {}) => async (input) => {
|
||||
const results = [];
|
||||
const errors = [];
|
||||
await pReduce(
|
||||
|
||||
@@ -2,8 +2,8 @@ const {dirname} = require('path');
|
||||
const {isString, isFunction, castArray, isArray, isPlainObject, isNil} = require('lodash');
|
||||
const resolveFrom = require('resolve-from');
|
||||
|
||||
const validateSteps = conf => {
|
||||
return conf.every(conf => {
|
||||
const validateSteps = (conf) => {
|
||||
return conf.every((conf) => {
|
||||
if (
|
||||
isArray(conf) &&
|
||||
(conf.length === 1 || conf.length === 2) &&
|
||||
|
||||
Reference in New Issue
Block a user