remove dead code and fix jshint warnings

This commit is contained in:
Forrest L Norvell
2014-05-23 23:42:13 -07:00
parent 626c3e4a7f
commit 1c29381891
31 changed files with 73 additions and 128 deletions

View File

@@ -23,7 +23,6 @@ function adduser (args, cb) {
, p : npm.config.get("_password") || ""
, e : npm.config.get("email") || ""
}
, changed = false
, u = {}
, fns = [readUsername, readPassword, readEmail, save]

View File

@@ -77,7 +77,6 @@ function linkStuff (pkg, folder, global, didRB, cb) {
// otherwise, then bins are in folder/../.bin
var parent = path.dirname(folder)
, gnm = global && npm.globalDir
, top = parent === npm.dir
, gtop = parent === gnm
log.verbose("linkStuff", [global, gnm, gtop, parent])
@@ -150,7 +149,7 @@ function rebuildBundles (pkg, folder, parent, gtop, cb) {
if (build._didBuild[file]) return cb()
log.verbose("rebuild bundle", file)
// if file is not a package dir, then don't do it.
fs.lstat(path.resolve(file, "package.json"), function (er, st) {
fs.lstat(path.resolve(file, "package.json"), function (er) {
if (er) return cb()
build_(false)(file, cb)
})
@@ -219,7 +218,6 @@ function linkMans (pkg, folder, parent, gtop, cb) {
var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/)
, stem = parseMan[1]
, sxn = parseMan[2]
, gz = parseMan[3] || ""
, bn = path.basename(stem)
, manDest = path.join(manRoot, "man" + sxn, bn)

View File

@@ -26,12 +26,11 @@ completion.completion = function (opts, cb) {
, path = require("path")
, bashExists = null
, zshExists = null
, bashProfExists = null
fs.stat(path.resolve(process.env.HOME, ".bashrc"), function (er, b) {
fs.stat(path.resolve(process.env.HOME, ".bashrc"), function (er) {
bashExists = !er
next()
})
fs.stat(path.resolve(process.env.HOME, ".zshrc"), function (er, b) {
fs.stat(path.resolve(process.env.HOME, ".zshrc"), function (er) {
zshExists = !er
next()
})
@@ -79,7 +78,6 @@ function completion (args, cb) {
, word = words[w]
, line = process.env.COMP_LINE
, point = +process.env.COMP_POINT
, lineLength = line.length
, partialLine = line.substr(0, point)
, partialWords = words.slice(0, w)
@@ -159,7 +157,7 @@ function dumpScript (cb) {
if (er) return cb(er)
d = d.replace(/^\#\!.*?\n/, "")
process.stdout.write(d, function (n) { cb() })
process.stdout.write(d, function () { cb() })
process.stdout.on("error", function (er) {
// Darwin is a real dick sometimes.
//
@@ -218,8 +216,6 @@ function configCompl (opts, cb) {
, split = word.match(/^(-+)((?:no-)*)(.*)$/)
, dashes = split[1]
, no = split[2]
, conf = split[3]
, confs = allConfs
, flags = configNames.filter(isFlag)
console.error(flags)
@@ -241,7 +237,6 @@ function configValueCompl (opts, cb) {
function isFlag (word) {
// shorthands never take args.
var split = word.match(/^(-*)((?:no-)+)?(.*)$/)
, dashes = split[1]
, no = split[2]
, conf = split[3]
return no || configTypes[conf] === Boolean || shorthands[conf]

View File

@@ -11,7 +11,6 @@ config.usage = "npm config set <key> <value>"
var log = require("npmlog")
, npm = require("./npm.js")
, spawn = require("child_process").spawn
, fs = require("graceful-fs")
, npmconf = require("npmconf")
, types = npmconf.defs.types
@@ -150,10 +149,6 @@ function sort (a, b) {
return a > b ? 1 : -1
}
function reverse (a, b) {
return a > b ? -1 : 1
}
function public (k) {
return !(k.charAt(0) === "_" || types[k] !== types[k])
}
@@ -236,7 +231,6 @@ function list (cb) {
, bpath = builtin.path
, bconfKeys = getKeys(bconf)
if (bconfKeys.length) {
var path = require("path")
msg += "; builtin config " + bpath + "\n"
bconfKeys.forEach(function (k) {
var val = (k.charAt(0) === "_")

View File

@@ -12,10 +12,6 @@ var fs = require("fs")
var asyncMap = require("slide").asyncMap
var path = require("path")
var readJson = require("read-package-json")
var archy = require("archy")
var util = require("util")
var RegClient = require("npm-registry-client")
var npmconf = require("npmconf")
var semver = require("semver")
var rm = require("./utils/gently-rm.js")
var log = require("npmlog")
@@ -94,7 +90,6 @@ function dedupe_ (dir, filter, unavoidable, dryrun, silent, cb) {
})]
})]
}).map(function (item) {
var name = item[0]
var set = item[1]
var ranges = set.map(function (i) {
@@ -138,7 +133,6 @@ function dedupe_ (dir, filter, unavoidable, dryrun, silent, cb) {
b.pop()
// find the longest chain that both A and B share.
// then push the name back on it, and join by /node_modules/
var res = []
for (var i = 0, al = a.length, bl = b.length; i < al && i < bl && a[i] === b[i]; i++);
return a.slice(0, i).concat(name).join(path.sep + "node_modules" + path.sep)
}) : undefined
@@ -205,9 +199,9 @@ function installAndRetest (set, filter, dir, unavoidable, silent, cb) {
// hrm?
return cb(new Error("danger zone\n" + name + " " +
+ regMatch + " " + locMatch))
regMatch + " " + locMatch))
}, function (er, installed) {
}, function (er) {
if (er) return cb(er)
asyncMap(remove, rm, function (er) {
if (er) return cb(er)

View File

@@ -15,8 +15,8 @@ var url_ = require("url")
, npm = require("./npm.js")
, registry = npm.registry
, opener = require("opener")
, path = require('path')
, log = require('npmlog')
, path = require("path")
, log = require("npmlog")
function url (json) {
return json.homepage ? json.homepage : "https://npmjs.org/package/" + json.name
@@ -28,7 +28,9 @@ function docs (args, cb) {
if (!pending) return getDoc('.', cb)
args.forEach(function(proj) {
getDoc(proj, function(err) {
if (err) return cb(err)
if (err) {
return cb(err)
}
--pending || cb()
})
})
@@ -39,8 +41,9 @@ function getDoc (project, cb) {
var package = path.resolve(process.cwd(), "package.json")
if (project === '.' || project === './') {
var json
try {
var json = require(package)
json = require(package)
if (!json.name) throw new Error('package.json does not have a valid "name" property')
project = json.name
} catch (e) {

View File

@@ -7,7 +7,6 @@ edit.usage = "npm edit <pkg>"
edit.completion = require("./utils/completion/installed-shallow.js")
var npm = require("./npm.js")
, spawn = require("child_process").spawn
, path = require("path")
, fs = require("graceful-fs")
, editor = require("editor")

View File

@@ -4,9 +4,6 @@ module.exports = helpSearch
var fs = require("graceful-fs")
, path = require("path")
, asyncMap = require("slide").asyncMap
, cliDocsPath = path.join(__dirname, "..", "doc", "cli")
, apiDocsPath = path.join(__dirname, "..", "doc", "api")
, log = require("npmlog")
, npm = require("./npm.js")
, glob = require("glob")
@@ -16,9 +13,6 @@ function helpSearch (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
if (!args.length) return cb(helpSearch.usage)
// see if we're actually searching the api docs.
var argv = npm.config.get("argv").cooked
var docPath = path.resolve(__dirname, "..", "doc")
return glob(docPath + "/*/*.md", function (er, files) {
if (er)
@@ -53,24 +47,27 @@ function searchFiles (args, files, cb) {
var data = files[file]
// skip if no matches at all
var match
for (var a = 0, l = args.length; a < l && !match; a++) {
var match = data.toLowerCase().indexOf(args[a].toLowerCase()) !== -1
match = data.toLowerCase().indexOf(args[a].toLowerCase()) !== -1
}
if (!match)
return
var lines = data.split(/\n+/)
var context = []
// if a line has a search term, then skip it and the next line.
// if the next line has a search term, then skip all 3
// otherwise, set the line to null. then remove the nulls.
for (var i = 0, l = lines.length; i < l; i ++) {
l = lines.length
for (var i = 0; i < l; i ++) {
var line = lines[i]
, nextLine = lines[i + 1]
, match = false
, ll
match = false
if (nextLine) {
for (var a = 0, ll = args.length; a < ll && !match; a ++) {
for (a = 0, ll = args.length; a < ll && !match; a ++) {
match = nextLine.toLowerCase()
.indexOf(args[a].toLowerCase()) !== -1
}
@@ -82,7 +79,7 @@ function searchFiles (args, files, cb) {
}
match = false
for (var a = 0, ll = args.length; a < ll && !match; a ++) {
for (a = 0, ll = args.length; a < ll && !match; a ++) {
match = line.toLowerCase().indexOf(args[a].toLowerCase()) !== -1
}
if (match) {
@@ -161,7 +158,7 @@ function formatResults (args, results, cb) {
var cols = Math.min(process.stdout.columns || Infinity, 80) + 1
var out = results.map(function (res, i, results) {
var out = results.map(function (res) {
var out = res.cmd
, r = Object.keys(res.hits).map(function (k) {
return k + ":" + res.hits[k]
@@ -174,7 +171,7 @@ function formatResults (args, results, cb) {
if (!npm.config.get("long")) return out
var out = "\n\n" + out
out = "\n\n" + out
+ "\n" + (new Array(cols)).join("—") + "\n"
+ res.lines.map(function (line, i) {
if (line === null || i > 3) return ""
@@ -191,12 +188,11 @@ function formatResults (args, results, cb) {
})
out = newOut.join("")
}
var color = ""
, reset = ""
if (npm.color) {
var color = "\033[31;40m"
, reset = "\033[0m"
} else {
var color = ""
, reset = ""
color = "\033[31;40m"
reset = "\033[0m"
}
out = out.split("\1").join(color)
.split("\2").join(reset)

View File

@@ -6,8 +6,7 @@ help.completion = function (opts, cb) {
getSections(cb)
}
var fs = require("graceful-fs")
, path = require("path")
var path = require("path")
, spawn = require("child_process").spawn
, npm = require("./npm.js")
, log = require("npmlog")
@@ -58,7 +57,6 @@ function help (args, cb) {
// npm help <section>: Try to find the path
var manroot = path.resolve(__dirname, "..", "man")
var htmlroot = path.resolve(__dirname, "..", "html", "doc")
// legacy
if (section === "global")
@@ -109,10 +107,11 @@ function viewMan (man, cb) {
env.MANPATH = manpath
var viewer = npm.config.get("viewer")
var conf
switch (viewer) {
case "woman":
var a = ["-e", "(woman-find-file \"" + man + "\")"]
var conf = { env: env, customFds: [ 0, 1, 2] }
conf = { env: env, customFds: [ 0, 1, 2] }
var woman = spawn("emacsclient", a, conf)
woman.on("close", cb)
break
@@ -122,9 +121,9 @@ function viewMan (man, cb) {
break
default:
var conf = { env: env, customFds: [ 0, 1, 2] }
var man = spawn("man", [num, section], conf)
man.on("close", cb)
conf = { env: env, customFds: [ 0, 1, 2] }
var manProcess = spawn("man", [num, section], conf)
manProcess.on("close", cb)
break
}
}
@@ -193,7 +192,6 @@ function usages () {
+ (usage.split("\n")
.join("\n" + (new Array(maxLen + 6).join(" "))))
}).join("\n")
return out
}

View File

@@ -121,7 +121,7 @@ function install (args, cb_) {
})
}
mkdir(where, function (er, made) {
mkdir(where, function (er) {
if (er) return cb(er)
// install dependencies locally by default,
// or install current folder globally
@@ -153,7 +153,6 @@ function install (args, cb_) {
installManyTop(deps.map(function (dep) {
var target = data.dependencies[dep]
, parsed = url.parse(target.replace(/^git\+/, "git"))
target = dep + "@" + target
return target
}), where, context, function(er, results) {
@@ -208,7 +207,7 @@ function findPeerInvalid_ (packageMap, fpiList) {
if (pkg.peerInvalid) {
var peersDepending = {};
for (peerName in packageMap) {
for (var peerName in packageMap) {
var peer = packageMap[peerName]
if (peer.peerDependencies && peer.peerDependencies[packageName]) {
peersDepending[peer.name + "@" + peer.version] =
@@ -291,8 +290,9 @@ function readDependencies (context, where, opts, cb) {
return cb(null, data, null)
}
var newwrap
try {
var newwrap = JSON.parse(wrapjson)
newwrap = JSON.parse(wrapjson)
} catch (ex) {
return cb(ex)
}
@@ -527,9 +527,6 @@ function installManyTop (what, where, context, cb_) {
function installManyTop_ (what, where, context, cb) {
var nm = path.resolve(where, "node_modules")
, names = context.explicit
? what.map(function (w) { return w.split(/@/).shift() })
: []
fs.readdir(nm, function (er, pkgs) {
if (er) return installMany(what, where, context, cb)
@@ -839,8 +836,6 @@ function installOne_ (target, where, context, cb) {
if (prettyWhere === ".") prettyWhere = null
if (isIncompatibleInstallOneInProgress(target, where)) {
var prettyTarget = path.relative(process.cwd(), targetFolder)
// just call back, with no error. the error will be detected in the
// final check for peer-invalid dependencies
return cb()
@@ -980,7 +975,6 @@ function prepareForInstallMany (packageData, depsKey, bundled, wrap, family) {
return true
}).map(function (d) {
var t = packageData[depsKey][d]
, parsed = url.parse(t.replace(/^git\+/, "git"))
t = d + "@" + t
return t
})

View File

@@ -132,7 +132,7 @@ function linkPkg (folder, cb_) {
if (er) return cb(er)
log.verbose("link", "build target", target)
// also install missing dependencies.
npm.commands.install(me, [], function (er, installed) {
npm.commands.install(me, [], function (er) {
if (er) return cb(er)
// build the global stuff. Don't run *any* scripts, because
// install command already will have done that.

View File

@@ -74,11 +74,6 @@ function ls (args, silent, cb) {
})
}
// only include
function filter (data, args) {
}
function alphasort (a, b) {
a = a.toLowerCase()
b = b.toLowerCase()
@@ -224,7 +219,6 @@ function makeArchy_ (data, long, dir, depth, parent, d) {
if (typeof data === "string") {
if (depth -1 <= npm.config.get("depth")) {
// just missing
var p = parent.link || parent.path
var unmet = "UNMET DEPENDENCY"
if (color) {
unmet = "\033[31;40m" + unmet + "\033[0m"
@@ -267,8 +261,7 @@ function makeArchy_ (data, long, dir, depth, parent, d) {
// add giturl to name@version
if (data._resolved) {
var p = url.parse(data._resolved)
if (isGitUrl(p))
if (isGitUrl(url.parse(data._resolved)))
out.label += " (" + data._resolved + ")"
}
@@ -293,7 +286,7 @@ function makeArchy_ (data, long, dir, depth, parent, d) {
return out
}
function getExtras (data, dir) {
function getExtras (data) {
var extras = []
if (data.description) extras.push(data.description)
@@ -328,7 +321,6 @@ function makeParseable_ (data, long, dir, depth, parent, d) {
if (typeof data === "string") {
if (data.depth < npm.config.get("depth")) {
var p = parent.link || parent.path
data = npm.config.get("long")
? path.resolve(parent.path, "node_modules", d)
+ ":"+d+"@"+JSON.stringify(data)+":INVALID:MISSING"

View File

@@ -15,8 +15,7 @@ if (typeof WScript !== "undefined") {
require('child-process-close')
var EventEmitter = require("events").EventEmitter
, npm = module.exports = new EventEmitter
, config = require("./config.js")
, npm = module.exports = new EventEmitter()
, npmconf = require("npmconf")
, log = require("npmlog")
, fs = require("graceful-fs")

View File

@@ -70,8 +70,7 @@ function outdated (args, silent, cb) {
// [[ dir, dep, has, want, latest ]]
function makePretty (p) {
var parseable = npm.config.get("parseable")
, dep = p[1]
var dep = p[1]
, dir = path.resolve(p[0], "node_modules", dep)
, has = p[2]
, want = p[3]
@@ -276,9 +275,6 @@ function shouldUpdate (args, dir, dep, has, req, depth, cb) {
var l = d.versions[d['dist-tags'].latest]
if (!l) return cb()
// set to true if found in doc
var found = false
var r = req
if (d['dist-tags'][req])
r = d['dist-tags'][req]

View File

@@ -15,7 +15,7 @@ prune.completion = require("./utils/completion/installed-deep.js")
function prune (args, cb) {
//check if is a valid package.json file
var jsonFile = path.resolve(npm.dir, "..", "package.json" )
readJson(jsonFile, log.warn, function (er, data) {
readJson(jsonFile, log.warn, function (er) {
if (er) return cb(er)
next()
})

View File

@@ -3,10 +3,8 @@ module.exports = publish
var npm = require("./npm.js")
, log = require("npmlog")
, tar = require("./utils/tar.js")
, path = require("path")
, readJson = require("read-package-json")
, fs = require("graceful-fs")
, lifecycle = require("./utils/lifecycle.js")
, chain = require("slide").chain
, Conf = require("npmconf").Conf

View File

@@ -4,10 +4,7 @@ module.exports = rebuild
var readInstalled = require("read-installed")
, semver = require("semver")
, log = require("npmlog")
, path = require("path")
, npm = require("./npm.js")
, asyncMap = require("slide").asyncMap
, fs = require("graceful-fs")
rebuild.usage = "npm rebuild [<name>[@<version>] [name[@<version>] ...]]"

View File

@@ -13,7 +13,6 @@ repo.completion = function (opts, cb) {
var npm = require("./npm.js")
, registry = npm.registry
, log = require("npmlog")
, opener = require("opener")
, github = require('github-url-from-git')
, githubUserRepo = require("github-url-from-username-repo")

View File

@@ -7,8 +7,6 @@ var lifecycle = require("./utils/lifecycle.js")
, readJson = require("read-package-json")
, log = require("npmlog")
, chain = require("slide").chain
, fs = require("graceful-fs")
, asyncMap = require("slide").asyncMap
runScript.usage = "npm run-script [<pkg>] <command>"

View File

@@ -121,7 +121,7 @@ function filterWords (data, args, notArgs) {
for (var i = 0, l = args.length; i < l; i ++) {
if (!match(words, args[i])) return false
}
for (var i = 0, l = notArgs.length; i < l; i ++) {
for (i = 0, l = notArgs.length; i < l; i ++) {
if (match(words, notArgs[i])) return false
}
return true
@@ -224,7 +224,7 @@ function addColorMarker (str, arg, i) {
var pieces = str.toLowerCase().split(arg.toLowerCase())
, p = 0
return pieces.map(function (piece, i) {
return pieces.map(function (piece) {
piece = str.substr(p, piece.length)
var mark = markStart
+ str.substr(p+piece.length, arg.length)
@@ -245,12 +245,12 @@ function colorize (line) {
}
function getMaxWidth() {
var cols
try {
var tty = require("tty")
, stdout = process.stdout
, cols = !tty.isatty(stdout.fd) ? Infinity
: process.stdout.getWindowSize()[0]
cols = (cols == 0) ? Infinity : cols
cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0]
cols = (cols === 0) ? Infinity : cols
} catch (ex) { cols = Infinity }
return cols
}

View File

@@ -60,8 +60,9 @@ function save (pkginfo, silent, cb) {
// copy the keys over in a well defined order
// because javascript objects serialize arbitrarily
pkginfo.dependencies = sortedObject(pkginfo.dependencies || {})
var swdata
try {
var swdata = JSON.stringify(pkginfo, null, 2) + "\n"
swdata = JSON.stringify(pkginfo, null, 2) + "\n"
} catch (er) {
log.error("shrinkwrap", "Error converting package info to json")
return cb(er)

View File

@@ -89,7 +89,7 @@ function addSubmodule (name, url, cb) {
}
var getSubmodules = function getSubmodules (cb) {
var getSubmodules = function (cb) {
var git = npm.config.get("git")
var args = [ "submodule", "status" ]

View File

@@ -1,7 +1,6 @@
module.exports = test
var testCmd = require("./utils/lifecycle.js").cmd("test")
, log = require("npmlog")
function test (args, cb) {
testCmd(args, function (er) {

View File

@@ -6,7 +6,6 @@ var readJson = require("read-package-json")
, gentlyRm = require("./utils/gently-rm.js")
, npm = require("./npm.js")
, path = require("path")
, fs = require("graceful-fs")
, lifecycle = require("./utils/lifecycle.js")
, asyncMap = require("slide").asyncMap
, chain = require("slide").chain
@@ -87,12 +86,12 @@ function rmMans (pkg, folder, parent, top, cb) {
var manRoot = path.resolve(npm.config.get("prefix"), "share", "man")
asyncMap(pkg.man, function (man, cb) {
if (Array.isArray(man)) {
man.forEach(rm)
man.forEach(rmMan)
} else {
rm(man)
rmMan(man)
}
function rm(man) {
function rmMan(man) {
var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/)
, stem = parseMan[1]
, sxn = parseMan[2]

View File

@@ -79,14 +79,15 @@ function saver (args, nm, cb_) {
// don't use readJson here, because we don't want all the defaults
// filled in, for mans and other bs.
fs.readFile(pj, 'utf8', function (er, json) {
var pkg
try {
var pkg = JSON.parse(json)
pkg = JSON.parse(json)
} catch (_) {}
if (!pkg) return cb_(null, data)
var bundle
if (npm.config.get('save-bundle')) {
var bundle = pkg.bundleDependencies || pkg.bundledDependencies
bundle = pkg.bundleDependencies || pkg.bundledDependencies
if (!Array.isArray(bundle)) bundle = undefined
}

View File

@@ -23,7 +23,6 @@ unpublish.completion = function (opts, cb) {
if (!pkgs || !pkgs.length) return cb()
var partial = opts.partialWord.split("@")
, pp = partial.shift()
, pv = partial.join("@")
pkgs = pkgs.filter(function (p) {
return p.indexOf(pp) === 0
})
@@ -41,7 +40,6 @@ unpublish.completion = function (opts, cb) {
}
function unpublish (args, cb) {
if (args.length > 1) return cb(unpublish.usage)
var thing = args.length ? args.shift().split("@") : []

View File

@@ -10,7 +10,6 @@ module.exports = update
update.usage = "npm update [pkg]"
var npm = require("./npm.js")
, lifecycle = require("./utils/lifecycle.js")
, asyncMap = require("slide").asyncMap
, log = require("npmlog")

View File

@@ -89,7 +89,7 @@ function checkGit (data, cb) {
})
function gitFound () {
exec(git, args, {env: env}, function (er, stdout, stderr) {
exec(git, args, {env: env}, function (er, stdout) {
var lines = stdout.trim().split("\n").filter(function (line) {
return line.trim() && !line.match(/^\?\? /)
}).map(function (line) {

View File

@@ -69,7 +69,7 @@ function view (args, silent, cb) {
if (data.time && data.time.unpublished) {
var u = data.time.unpublished
var er = new Error("Unpublished by " + u.name + " on " + u.time)
er = new Error("Unpublished by " + u.name + " on " + u.time)
er.statusCode = 404
er.code = "E404"
er.pkgid = data._id
@@ -144,8 +144,9 @@ function search (data, fields, version, title) {
, tail = fields
while (!field && fields.length) field = tail.shift()
fields = [field].concat(tail)
var o
if (!field && !tail.length) {
var o = {}
o = {}
o[version] = {}
o[version][title] = data
return o
@@ -165,7 +166,6 @@ function search (data, fields, version, title) {
return search(data[0], fields, version, title)
}
var results = []
, res = null
data.forEach(function (data, i) {
var tl = title.length
, newt = title.substr(0, tl-(fields.join(".").length) - 1)
@@ -187,7 +187,7 @@ function search (data, fields, version, title) {
return new Error("Not an object: "+data)
}
}
var o = {}
o = {}
o[version] = {}
o[version][title] = data
return o
@@ -199,7 +199,7 @@ function printData (data, name, cb) {
, showVersions = versions.length > 1
, showFields
versions.forEach(function (v, i) {
versions.forEach(function (v) {
var fields = Object.keys(data[v])
showFields = showFields || (fields.length > 1)
fields.forEach(function (f) {

View File

@@ -7,7 +7,7 @@ whoami.usage = "npm whoami\n(just prints the 'username' config)"
function whoami (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
var me = npm.config.get("username")
msg = me ? me : "Not authed. Run 'npm adduser'"
var msg = me ? me : "Not authed. Run 'npm adduser'"
if (!silent) console.log(msg)
process.nextTick(cb.bind(this, null, me))
}

View File

@@ -1,6 +1,5 @@
// happy xmas
var npm = require("./npm.js")
, log = require("npmlog")
var log = require("npmlog")
module.exports = function (args, cb) {
var s = process.platform === "win32" ? " *" : " \u2605"
@@ -20,26 +19,26 @@ w("\n")
for (var i = 0; i < H; i ++) w(" ")
w(x+"\033[33m"+s+"\n")
var M = H * 2 - 1
for (L = 1; L <= H; L ++) {
for (var L = 1; L <= H; L ++) {
var O = L * 2 - 2
var S = (M - O) / 2
for (var i = 0; i < S; i ++) w(" ")
for (i = 0; i < S; i ++) w(" ")
w(x+"\033[32m"+f)
for (var i = 0; i < O; i ++) w(
for (i = 0; i < O; i ++) w(
"\033["+oc[Math.floor(Math.random()*oc.length)]+"m"+
o[Math.floor(Math.random() * o.length)]
)
w(x+"\033[32m"+b+"\n")
}
w(" ")
for (var i = 1; i < H; i ++) w("\033[32m"+l)
for (i = 1; i < H; i ++) w("\033[32m"+l)
w("| "+x+" |")
for (var i = 1; i < H; i ++) w("\033[32m"+l)
for (i = 1; i < H; i ++) w("\033[32m"+l)
if (H > 10) {
w("\n ")
for (var i = 1; i < H; i ++) w(" ")
for (i = 1; i < H; i ++) w(" ")
w("| "+x+" |")
for (var i = 1; i < H; i ++) w(" ")
for (i = 1; i < H; i ++) w(" ")
}
})(20)
w("\n\n")