Comparing version 2.9.0 to 2.9.1
History | ||
======= | ||
## 2.9.1 | ||
* Refactor lodash calls to be tolerant of v3 or v4 as a temporary bandaid to | ||
a solution for the real underlying issue of: | ||
[#99](https://github.com/FormidableLabs/builder/issues/99) | ||
## 2.9.0 | ||
@@ -5,0 +11,0 @@ |
@@ -137,10 +137,10 @@ "use strict"; | ||
Config.prototype._loadPkgs = function (archetypes) { | ||
var self = this; | ||
var CWD_PKG = this._lazyRequire(path.join(process.cwd(), "package.json")) || {}; | ||
// Load base packages. | ||
var pkgs = [_.extend({ name: "ROOT" }, CWD_PKG)].concat(_(archetypes) | ||
var pkgs = [_.extend({ name: "ROOT" }, CWD_PKG)].concat(_.chain(archetypes) | ||
.map(function (name) { | ||
/*eslint-disable no-invalid-this*/ | ||
return _.extend({ name: name }, this._loadArchetypePkg(name)); | ||
}, this) | ||
return _.extend({ name: name }, self._loadArchetypePkg(name)); | ||
}) | ||
.reverse() | ||
@@ -151,3 +151,2 @@ .value()); | ||
pkgs = _.mapValues(pkgs, function (pkg) { | ||
/*eslint-disable no-invalid-this*/ | ||
var mod = pkg.mod || {}; | ||
@@ -157,5 +156,5 @@ | ||
config: mod.config, | ||
scripts: pkg.name === "ROOT" ? mod.scripts || {} : this._loadArchetypeScripts(pkg) | ||
scripts: pkg.name === "ROOT" ? mod.scripts || {} : self._loadArchetypeScripts(pkg) | ||
}, pkg); | ||
}, this); | ||
}); | ||
@@ -175,7 +174,12 @@ return pkgs; | ||
var scripts = (pkg.mod || {}).scripts || {}; | ||
return _(scripts) | ||
.pairs() | ||
return _.chain(scripts) | ||
// Pairs. | ||
.map(function (v, k) { return [k, v]; }) | ||
// Remove `builder:` internal tasks. | ||
.reject(function (pair) { return pair[0].indexOf("builder:") === 0; }) | ||
.object() | ||
// Object. | ||
.reduce(function (memo, pair) { | ||
memo[pair[0]] = pair[1]; | ||
return memo; | ||
}, {}) | ||
.value(); | ||
@@ -197,3 +201,3 @@ }; | ||
pkgs = _.filter(pkgs, function (pkg) { | ||
return _.contains(archetypes, pkg.name); | ||
return _.includes(archetypes, pkg.name); | ||
}); | ||
@@ -203,3 +207,3 @@ } | ||
// First, get all keys. | ||
var keys = _(pkgs) | ||
var keys = _.chain(pkgs) | ||
.map(function (pkg) { | ||
@@ -213,4 +217,4 @@ return _.keys(pkg[field]); | ||
}) | ||
// Filter to unique keys and we're in order (`true`) | ||
.unique(true) | ||
// Filter to unique keys. | ||
.uniq() | ||
.value(); | ||
@@ -220,3 +224,3 @@ | ||
return _.map(keys, function (key) { | ||
var tasks = _(pkgs) | ||
var tasks = _.chain(pkgs) | ||
.filter(function (pkg) { return pkg[field][key]; }) | ||
@@ -230,3 +234,3 @@ .map(function (pkg) { | ||
return "\n " + chalk.cyan(key) + tasks; | ||
}, this).join("\n"); | ||
}).join("\n"); | ||
}; | ||
@@ -261,3 +265,3 @@ | ||
Config.prototype.getCommands = function (cmd) { | ||
return _(this.pkgs) | ||
return _.chain(this.pkgs) | ||
.map(function (pkg) { | ||
@@ -307,3 +311,3 @@ return { archetypeName: pkg.name, archetypePath: pkg.path, cmd: pkg.scripts[cmd] }; | ||
var pkgs = this.pkgs; | ||
var configNames = _(pkgs) | ||
var configNames = _.chain(pkgs) | ||
.map(function (pkg) { return _.keys(pkg.config); }) | ||
@@ -315,3 +319,3 @@ .flatten() | ||
// Take "first" config value in arrays as "winning" value. | ||
return _(configNames) | ||
return _.chain(configNames) | ||
.map(function (name) { | ||
@@ -322,3 +326,7 @@ return [name, _.find(pkgs, function (pkg) { | ||
}) | ||
.object() | ||
// Object. | ||
.reduce(function (memo, pair) { | ||
memo[pair[0]] = pair[1]; | ||
return memo; | ||
}, {}) | ||
.value(); | ||
@@ -325,0 +333,0 @@ } |
@@ -111,11 +111,12 @@ "use strict"; | ||
Environment.prototype.updateConfigVars = function (pkgConfigs) { | ||
var self = this; | ||
_.each(pkgConfigs, function (val, name) { | ||
/*eslint-disable no-invalid-this*/ | ||
var fullName = "npm_package_config_" + name; | ||
if (!_.has(this.env, fullName)) { | ||
this.env[fullName] = val; | ||
if (!_.has(self.env, fullName)) { | ||
self.env[fullName] = val; | ||
} | ||
}, this); | ||
}); | ||
return this.env; | ||
}; |
@@ -55,3 +55,3 @@ "use strict"; | ||
// Infer action. | ||
if (!_.contains(this.ACTIONS.concat(["version"]), this._action)) { | ||
if (!_.includes(this.ACTIONS.concat(["version"]), this._action)) { | ||
throw new Error("Invalid action: " + this._action + | ||
@@ -68,3 +68,3 @@ " - Valid actions: " + this.ACTIONS.join(", ")); | ||
cmd = this._commands.join(", "); | ||
} else if (_.contains(["help", "version"], this._action)) { | ||
} else if (_.includes(["help", "version"], this._action)) { | ||
cmd = null; | ||
@@ -117,7 +117,8 @@ } | ||
Task.prototype.getCommand = function (cmd) { | ||
var self = this; | ||
// Select first non-passthrough command. | ||
var task = _.find(this._config.getCommands(cmd), function (obj) { | ||
/*eslint-disable no-invalid-this*/ | ||
return !this.isPassthrough(obj.cmd); | ||
}, this); | ||
return !self.isPassthrough(obj.cmd); | ||
}); | ||
@@ -166,3 +167,3 @@ // Error out if still can't find task. | ||
// One matching command is an action: `builder help run` | ||
var action = _.contains(this.ACTIONS, cmd) ? cmd : null; | ||
var action = _.includes(this.ACTIONS, cmd) ? cmd : null; | ||
var actionDisplay = action ? chalk.red(action) : "<action>"; | ||
@@ -169,0 +170,0 @@ var actions = this.ACTIONS.map(function (val) { |
{ | ||
"name": "builder", | ||
"version": "2.9.0", | ||
"version": "2.9.1", | ||
"description": "An NPM-based task runner", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90167
1462