From 03bd66932c83f4233c9e3fb33bd36a1edf930db9 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 10 Jun 2011 18:10:14 -0700 Subject: [PATCH] Support 'npm-g' as a global bin --- bin/npm.js | 6 ++++++ package.json | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/npm.js b/bin/npm.js index b508757346ca5..32d74b34e5161 100755 --- a/bin/npm.js +++ b/bin/npm.js @@ -17,6 +17,12 @@ var fs = require("../lib/utils/graceful-fs") , types = configDefs.types , nopt = require("nopt") +// if npm is called as "npmg" or "npm_g", then +// run in global mode. +if(path.basename(process.argv[1]).slice(-1) === "g") { + process.argv.splice(1, 1, "npm", "-g") +} + log.verbose(process.argv, "cli") var conf = nopt(types, shorthands) diff --git a/package.json b/package.json index 04cc45a409e72..9f71636e9dea9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ , "bin" : "./bin" } , "main" : "npm" -, "bin" : "./bin/npm.js" +, "bin" : { "npm" : "./bin/npm.js" + , "npm_g" : "./bin/npm.js" + , "npm-g" : "./bin/npm.js" } , "dependencies" : { "semver" : "1" , "abbrev" : "1"