diff --git a/package.json b/package.json index a257cf2..190ded9 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "wzrd": "^1.2.1", "brfs": "^1.3.0", "through": "^2.3.6", - "browserify-fs": "^1.0.0" + "browserify-fs": "^1.0.0", + "asarray": "^0.1.0" }, "license": "MIT" } diff --git a/webnpm.js b/webnpm.js index eca055a..d06f641 100644 --- a/webnpm.js +++ b/webnpm.js @@ -222,4 +222,13 @@ function main() { console.log('WebNPM loaded. Try browserify() or npm.commands.*()'); }); + + var asarray = require('asarray'); + + global.npm_cli = function() { + // Call the NPM command-line interface with the given function arguments + process.argv = asarray(arguments); // for .slice, on Array but not arguments + require('npm/cli.js'); + // this only works once :( TODO + }; }