Skip to content

Commit 03bd669

Browse files
committed
Support 'npm-g' as a global bin
1 parent 7124cf3 commit 03bd669

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bin/npm.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ var fs = require("../lib/utils/graceful-fs")
1717
, types = configDefs.types
1818
, nopt = require("nopt")
1919

20+
// if npm is called as "npmg" or "npm_g", then
21+
// run in global mode.
22+
if(path.basename(process.argv[1]).slice(-1) === "g") {
23+
process.argv.splice(1, 1, "npm", "-g")
24+
}
25+
2026
log.verbose(process.argv, "cli")
2127

2228
var conf = nopt(types, shorthands)

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
, "bin" : "./bin"
2121
}
2222
, "main" : "npm"
23-
, "bin" : "./bin/npm.js"
23+
, "bin" : { "npm" : "./bin/npm.js"
24+
, "npm_g" : "./bin/npm.js"
25+
, "npm-g" : "./bin/npm.js" }
2426
, "dependencies" :
2527
{ "semver" : "1"
2628
, "abbrev" : "1"

0 commit comments

Comments
 (0)