Socket
Socket
Sign inDemoInstall

builder

Package Overview
Dependencies
6
Maintainers
5
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.2 to 2.3.3

4

bin/builder-core.js

@@ -30,5 +30,5 @@ "use strict";

log.error("builder-core:end:" + process.pid,
"Ended with error: " + chalk.gray(task) + " - " + chalk.red(err.message.split("\n")[0]));
"Task: " + chalk.gray(task) + ", Error: " + chalk.red(err.message));
} else {
log.info("builder-core:end:" + process.pid, "Ended normally: " + chalk.gray(task));
log.info("builder-core:end:" + process.pid, "Task: " + chalk.gray(task) + " ended normally");
}

@@ -35,0 +35,0 @@

History
=======
## 2.3.3
* Harmonize log messages with standardized command + environment strings.
* Add `builder <action> --[no-]bail` flag to control failing vs. non-failing
concurrent tasks. ( [@exogen][] )
[#64](https://github.com/FormidableLabs/builder/issues/64)
## 2.3.2

@@ -5,0 +12,0 @@

@@ -32,2 +32,7 @@ "use strict";

};
var FLAG_BAIL = {
desc: "End all processes after the first failure (default: `true`)",
types: [Boolean],
default: true
};

@@ -54,3 +59,4 @@ // Option flags.

queue: FLAG_QUEUE,
buffer: FLAG_BUFFER
buffer: FLAG_BUFFER,
bail: FLAG_BAIL
},

@@ -63,2 +69,3 @@

buffer: FLAG_BUFFER,
bail: FLAG_BAIL,
"envs-path": {

@@ -65,0 +72,0 @@ desc: "Path to JSON env variable array file (default: `null`)",

@@ -25,2 +25,8 @@ "use strict";

// Helper for command strings for logging.
var cmdStr = function (cmd, opts) {
return "Command: " + chalk.gray(cmd) +
(opts.taskEnv ? ", Environment: " + chalk.magenta(JSON.stringify(opts.taskEnv)) : "");
};
/**

@@ -44,3 +50,3 @@ * Run a single task.

log.info("proc:start", cmd);
log.info("proc:start", cmdStr(cmd, opts));
var proc = exec(cmd, shOpts, function (err, stdout, stderr) {

@@ -56,3 +62,3 @@ var code = err ? err.code || 1 : 0;

log[level]("proc:end:" + code, cmd);
log[level]("proc:end:" + code, cmdStr(cmd, opts));
callback(err);

@@ -82,3 +88,2 @@ });

var tracker = opts.tracker;
var taskEnv = opts.taskEnv;

@@ -104,4 +109,3 @@ // State.

if (error && tries > 0) {
log.warn("proc:retry", chalk.red(tries) + " tries left, Command: " + chalk.gray(cmd) +
(taskEnv ? ", Environment: " + chalk.magenta(JSON.stringify(taskEnv)) : ""));
log.warn("proc:retry", chalk.red(tries) + " tries left, " + cmdStr(cmd, opts));
}

@@ -121,3 +125,3 @@

var code = error.code || 1;
log.error("proc:error", "Code: " + code + ", Command: " + cmd);
log.error("proc:error", "Code: " + code + ", " + cmdStr(cmd, opts));
}

@@ -169,6 +173,16 @@

tracker.kill(function () {
callback(err);
if (finish.errors.length > 1) {
log.error("finish", "Hit " + chalk.red(finish.errors.length) + " errors: \n" +
finish.errors.map(function (errItem) {
return " * " + chalk.gray(errItem.name) + ": " + chalk.red(errItem.message);
}).join("\n"));
}
callback(err || finish.errors[0]);
});
});
// Create error storage.
finish.errors = [];
// Add, invoke, and hook to final callback if setup dies early.

@@ -221,11 +235,13 @@ var setup = tracker.add(addSetup(opts.setup, shOpts));

// Get mapper (queue vs. non-queue)
var queue = opts.queue;
var map = queue ?
async.mapLimit.bind(async, cmds, queue) :
async.map.bind(async, cmds);
var bail = opts.bail;
log.info("concurrent", "Starting with queue size: " + chalk.magenta(queue || "unlimited"));
map(function (cmd, cb) {
retry(cmd, shOpts, _.extend({ tracker: tracker }, opts), cb);
async.mapLimit(cmds, queue || Infinity, function (cmd, cb) {
retry(cmd, shOpts, _.extend({ tracker: tracker }, opts), function (err) {
if (err) {
finish.errors.push(err);
}
cb(bail ? err : null);
});
}, finish);

@@ -248,11 +264,8 @@ },

// Get mapper (queue vs. non-queue)
var queue = opts.queue;
var taskEnvs = opts._envs;
var map = queue ?
async.mapLimit.bind(async, taskEnvs, queue) :
async.map.bind(async, taskEnvs);
var bail = opts.bail;
log.info("envs", "Starting with queue size: " + chalk.magenta(queue || "unlimited"));
map(function (taskEnv, cb) {
async.mapLimit(taskEnvs, queue || Infinity, function (taskEnv, cb) {
// Add each specific set of environment variables.

@@ -264,7 +277,11 @@ // Clone `shOpts` to turn `env` into a plain object: in Node 4+

log.info("envs", "Starting environment " + chalk.magenta(JSON.stringify(taskEnv)) +
" run for command: " + chalk.gray(cmd));
retry(cmd, taskShOpts, taskOpts, cb);
log.info("envs", "Starting " + cmdStr(cmd, taskOpts));
retry(cmd, taskShOpts, taskOpts, function (err) {
if (err) {
finish.errors.push(err);
}
cb(bail ? err : null);
});
}, finish);
}
};
{
"name": "builder",
"version": "2.3.2",
"version": "2.3.3",
"description": "An NPM-based task runner",

@@ -5,0 +5,0 @@ "repository": {

@@ -167,3 +167,4 @@ [![Travis Status][trav_img]][trav_site]

`npm run <task1> | npm run <task2> | npm run <task3>`, but kills all processes on
first non-zero exit (which makes it suitable for test tasks).
first non-zero exit (which makes it suitable for test tasks), unless `--no-bail`
is provided.

@@ -181,2 +182,3 @@ ```sh

* `--[no-]buffer`: Buffer output until process end (default: `false`)
* `--[no-]bail`: End all processes after the first failure (default: `true`)

@@ -198,3 +200,3 @@ Note that `tries` will retry _individual_ tasks that are part of the concurrent

... but kills all processes on first non-zero exit (which makes it suitable for
test tasks). Usage:
test tasks), unless `--no-bail` is provided. Usage:

@@ -220,2 +222,3 @@ ```sh

* `--[no-]buffer`: Buffer output until process end (default: `false`)
* `--[no-]bail`: End all processes after the first failure (default: `true`)
* `--envs-path`: Path to JSON env variable array file (default: `null`)

@@ -222,0 +225,0 @@

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