Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cli.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-01-09 10:11:34 +0300
committerisaacs <i@izs.me>2011-01-09 10:11:34 +0300
commit1424fb379939625dd03ce15ca617fbb8244e5564 (patch)
treeb9a0e2219bf8256e15b3096ab47bacdaeaf95f3b /cli.js
parent609ed5643a678ade30872cfb57474a5f9ca95811 (diff)
Put executables in ./bin
Move towards having multiple different executables for various things.
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js56
1 files changed, 1 insertions, 55 deletions
diff --git a/cli.js b/cli.js
index f2e88d6b6..f9478d85a 100755
--- a/cli.js
+++ b/cli.js
@@ -1,56 +1,2 @@
#!/usr/bin/env node
-;(function () { // wrapper in case we're in module_context mode
-var log = require("./lib/utils/log")
-log.waitForConfig()
-log.info("ok", "it worked if it ends with")
-
-var fs = require("./lib/utils/graceful-fs")
- , path = require("path")
- , sys = require("./lib/utils/sys")
- , npm = require("./npm")
- , ini = require("./lib/utils/ini")
- , rm = require("./lib/utils/rm-rf")
- , errorHandler = require("./lib/utils/error-handler")
-
- , argv = process.argv.slice(2)
- , parseArgs = require("./lib/utils/parse-args")
-
-log.verbose(argv, "cli")
-
-var conf = parseArgs(argv)
-npm.argv = conf.argv.remain
-if (npm.deref(npm.argv[0])) npm.command = npm.argv.shift()
-else conf.usage = true
-
-
-if (conf.version) {
- console.log(npm.version)
- return
-} else log("npm@"+npm.version, "using")
-log("node@"+process.version, "using")
-
-// make sure that this version of node works with this version of npm.
-var semver = require("./lib/utils/semver")
- , nodeVer = process.version
- , reqVer = npm.nodeVersionRequired
-if (reqVer && !semver.satisfies(nodeVer, reqVer)) {
- return errorHandler(new Error(
- "npm doesn't work with node " + nodeVer
- + "\nRequired: node@" + reqVer), true)
-}
-
-process.on("uncaughtException", errorHandler)
-
-if (conf.usage && npm.command !== "help") {
- npm.argv.unshift(npm.command)
- npm.command = "help"
-}
-
-// now actually fire up npm and run the command.
-// this is how to use npm programmatically:
-conf._exit = true
-npm.load(conf, function (er) {
- if (er) return errorHandler(er)
- npm.commands[npm.command](npm.argv, errorHandler)
-})
-})()
+require("./bin/npm.js")