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

npm.js - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/npm.js
blob: 0a0414d015236285a5945caaf99227b75f35caf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

// always return the same npm object.  This is important, as
// programs might want to set the paths or other things.
var moduleName = __filename.replace(/\.js$/, '');
if (module.id !== moduleName) {
  module.exports = require(moduleName);
  return;
}

var npm = exports;

var utils = require("./lib/utils");

npm.moduleName = moduleName;

[ "install"
, "activate"
, "deactivate"
, "ls"
, "build"
, "link"
].forEach(function (c) {
  npm[c] = require("./lib/"+c);
});
npm.list = npm.ls;

var registry = {};

npm.set = set;
npm.get = get;

function set (name, data) { return utils.set(registry, name, data) };
function get (name) { return utils.get(registry, name) };

var path = require("path");

npm.root = path.join(process.env.HOME, ".node_libraries");
npm.__defineGetter__("dir", function () { return path.join(npm.root, ".npm") });
npm.__defineGetter__("tmp", function () { return path.join(npm.dir, ".tmp") });