Merge pull request #491 from straccio/master

Added pluginPath based on npm
This commit is contained in:
Khaos Tian
2016-11-28 13:21:27 -08:00
committed by GitHub
3 changed files with 36 additions and 35 deletions

2
.gitignore vendored
View File

@@ -10,3 +10,5 @@ npm-debug.log
# Ignore any extra plugins in the example directory that aren't in Git already
# (this is a sandbox for the user)
example-plugins
.idea

View File

@@ -67,7 +67,7 @@ Logger.prototype.log = function(level, msg) {
// prepend timestamp
var date = new Date();
msg = "[" + date.toLocaleString() + "]" + " " + msg;
msg = chalk.white("[" + date.toLocaleString() + "]") + " " + msg;
func(msg);
}

View File

@@ -119,9 +119,10 @@ Plugin.getDefaultPaths = function() {
} else {
paths.push('/usr/local/lib/node_modules');
paths.push('/usr/lib/node_modules');
const exec = require('child_process').execSync;
paths.push(exec('/bin/echo -n "$(npm -g prefix)/lib/node_modules"').toString('utf8'));
}
}
return paths;
}
@@ -165,14 +166,12 @@ Plugin.installed = function() {
// reconstruct full path
var pluginPath = path.join(requirePath, name);
try {
// we only care about directories
if (!fs.statSync(pluginPath).isDirectory()) continue;
} catch (e) {
continue;
}
// does this module contain a package.json?
var pjson;
try {