Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib/node_mod.../npm/lib
File: explore.js
// npm explore <pkg>[@<version>]
[0] Fix | Delete
// open a subshell to the package folder.
[1] Fix | Delete
[2] Fix | Delete
module.exports = explore
[3] Fix | Delete
explore.usage = 'npm explore <pkg> [ -- <command>]'
[4] Fix | Delete
explore.completion = require('./utils/completion/installed-shallow.js')
[5] Fix | Delete
[6] Fix | Delete
var npm = require('./npm.js')
[7] Fix | Delete
var spawn = require('./utils/spawn')
[8] Fix | Delete
var path = require('path')
[9] Fix | Delete
var fs = require('graceful-fs')
[10] Fix | Delete
var isWindows = require('./utils/is-windows.js')
[11] Fix | Delete
var escapeExecPath = require('./utils/escape-exec-path.js')
[12] Fix | Delete
var escapeArg = require('./utils/escape-arg.js')
[13] Fix | Delete
var output = require('./utils/output.js')
[14] Fix | Delete
var log = require('npmlog')
[15] Fix | Delete
[16] Fix | Delete
function explore (args, cb) {
[17] Fix | Delete
if (args.length < 1 || !args[0]) return cb(explore.usage)
[18] Fix | Delete
var p = args.shift()
[19] Fix | Delete
[20] Fix | Delete
var cwd = path.resolve(npm.dir, p)
[21] Fix | Delete
var opts = {cwd: cwd, stdio: 'inherit'}
[22] Fix | Delete
[23] Fix | Delete
var shellArgs = []
[24] Fix | Delete
if (args.length) {
[25] Fix | Delete
if (isWindows) {
[26] Fix | Delete
var execCmd = escapeExecPath(args.shift())
[27] Fix | Delete
var execArgs = [execCmd].concat(args.map(escapeArg))
[28] Fix | Delete
opts.windowsVerbatimArguments = true
[29] Fix | Delete
shellArgs = ['/d', '/s', '/c'].concat(execArgs)
[30] Fix | Delete
} else {
[31] Fix | Delete
shellArgs = ['-c', args.map(escapeArg).join(' ').trim()]
[32] Fix | Delete
}
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
var sh = npm.config.get('shell')
[36] Fix | Delete
fs.stat(cwd, function (er, s) {
[37] Fix | Delete
if (er || !s.isDirectory()) {
[38] Fix | Delete
return cb(new Error(
[39] Fix | Delete
"It doesn't look like " + p + ' is installed.'
[40] Fix | Delete
))
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
if (!shellArgs.length) {
[44] Fix | Delete
output(
[45] Fix | Delete
'\nExploring ' + cwd + '\n' +
[46] Fix | Delete
"Type 'exit' or ^D when finished\n"
[47] Fix | Delete
)
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
log.silly('explore', {sh, shellArgs, opts})
[51] Fix | Delete
var shell = spawn(sh, shellArgs, opts)
[52] Fix | Delete
shell.on('close', function (er) {
[53] Fix | Delete
// only fail if non-interactive.
[54] Fix | Delete
if (!shellArgs.length) return cb()
[55] Fix | Delete
cb(er)
[56] Fix | Delete
})
[57] Fix | Delete
})
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function