]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/bin/npm-cli.js
Adding missing bin folder in integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / bin / npm-cli.js
1 #!/usr/bin/env node
2 ;(function () { // wrapper in case we're in module_context mode
3
4 // windows: running "npm blah" in this folder will invoke WSH, not node.
5 if (typeof WScript !== "undefined") {
6   WScript.echo("npm does not work when run\n"
7               +"with the Windows Scripting Host\n\n"
8               +"'cd' to a different directory,\n"
9               +"or type 'npm.cmd <args>',\n"
10               +"or type 'node npm <args>'.")
11   WScript.quit(1)
12   return
13 }
14
15
16 process.title = "npm"
17
18 var log = require("npmlog")
19 log.pause() // will be unpaused when config is loaded.
20 log.info("it worked if it ends with", "ok")
21
22 var path = require("path")
23   , npm = require("../lib/npm.js")
24   , npmconf = require("../lib/config/core.js")
25   , errorHandler = require("../lib/utils/error-handler.js")
26
27   , configDefs = npmconf.defs
28   , shorthands = configDefs.shorthands
29   , types = configDefs.types
30   , nopt = require("nopt")
31
32 // if npm is called as "npmg" or "npm_g", then
33 // run in global mode.
34 if (path.basename(process.argv[1]).slice(-1)  === "g") {
35   process.argv.splice(1, 1, "npm", "-g")
36 }
37
38 log.verbose("cli", process.argv)
39
40 var conf = nopt(types, shorthands)
41 npm.argv = conf.argv.remain
42 if (npm.deref(npm.argv[0])) npm.command = npm.argv.shift()
43 else conf.usage = true
44
45
46 if (conf.version) {
47   console.log(npm.version)
48   return
49 }
50
51 if (conf.versions) {
52   npm.command = "version"
53   conf.usage = false
54   npm.argv = []
55 }
56
57 log.info("using", "npm@%s", npm.version)
58 log.info("using", "node@%s", process.version)
59
60 process.on("uncaughtException", errorHandler)
61
62 if (conf.usage && npm.command !== "help") {
63   npm.argv.unshift(npm.command)
64   npm.command = "help"
65 }
66
67 // now actually fire up npm and run the command.
68 // this is how to use npm programmatically:
69 conf._exit = true
70 npm.load(conf, function (er) {
71   if (er) return errorHandler(er)
72   npm.commands[npm.command](npm.argv, errorHandler)
73 })
74
75 })()