Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
var _ = require("lodash");
var path = require("path");
var findNodeModules = require("find-node-modules");
var args = require("./args");
var clone = require("./utils/clone");
var jsonParse = require("./utils/json").parse;
Expand All @@ -25,8 +26,8 @@ var splitPath = function (val) {
var uniqueVals = function (val, i, vals) { return vals.indexOf(val) === i; };

// Node directories.
var CWD_BIN = path.join(process.cwd(), "node_modules/.bin");
var CWD_NODE_PATH = path.join(process.cwd(), "node_modules");
var CWD_NODE_PATHS = findNodeModules({ cwd: process.cwd(), relative: false });
var CWD_BINS = CWD_NODE_PATHS.map(function (p) { return path.join(p, ".bin"); });

/**
* Environment wrapper.
Expand Down Expand Up @@ -85,7 +86,7 @@ var Environment = module.exports = function (opts) {
Environment.prototype.updatePath = function (archetypePaths) {
return []
.concat(archetypePaths || [])
.concat([CWD_BIN])
.concat(CWD_BINS || [])
.concat(splitPath(this.env[ENV_PATH_NAME]))
.concat(splitPath(this.env.PATH))
.filter(uniqueVals)
Expand All @@ -107,7 +108,7 @@ Environment.prototype.updatePath = function (archetypePaths) {
Environment.prototype.updateNodePath = function (archetypeNodePaths) {
return []
.concat(archetypeNodePaths || [])
.concat([CWD_NODE_PATH])
.concat(CWD_NODE_PATHS || [])
.concat(splitPath(this.env.NODE_PATH))
.filter(uniqueVals)
.join(DELIM);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dependencies": {
"async": "^1.4.2",
"chalk": "^1.1.1",
"find-node-modules": "^1.0.4",
"js-yaml": "^3.4.3",
"lodash": "^3.10.1",
"nopt": "^3.0.6",
Expand Down