How to use the npm.dir function in npm

To help you get started, we’ve selected a few npm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rf / nd / lib / find.js View on Github external
exports.root = function root (module, done, global) {
  if (global) npm.dir = npm.globalDir;
  else npm.dir = process.cwd();
  npm.config.set('global', !!global);

  npm.commands.ls([], true, function (err, data) {
    if (err) return done(err);

    var queue = [data], found, node;

    // breadth first search the tree for the node we're looking for
    while (queue.length > 0) {
      node = queue.shift();
//        console.log(node.name);
      if (node.name == module && node.path) {
        done(null, node.path);
        found = true;
        break;
github arikon / npm2debian / lib / cli.js View on Github external
.then(function() {
                    console.log('versioned = %s', opts.versioned);
                    console.log('bin = %s', NPM.bin);
                    console.log('dir = %s', NPM.dir);
                    console.log('cache = %s', NPM.cache);
                    console.log('tmp = %s', NPM.tmp);
                    console.log('binaries = %s', SYS.inspect(BIN));

                    return args.pkg.reduce(function(done, pkg) {
                        return Q.all([done, debianize(pkg, opts)]).get(0);
                    }, undefined);
                });
github rf / nd / app.js View on Github external
function listModules () {
  console.log("Available modules:".bold);
  npm.dir = process.cwd();
  npm.config.set('global', false);
  npm.commands.ls([], false, function (err, data) {
    if (err) return app.log.error(err);
  });
}
github arikon / npm2debian / lib / source.js View on Github external
asyncMap(list, function (i, cb) {
    var target = path.join(npm.dir, i[0], i[1], "package")
    cache.unpack(i[0], i[1], target, cb)
    buildList.push(target)
  }, function (er) {
    if (er) return cb(er)
github bnoguchi / browser-require / lib / npm_module.js View on Github external
get: function () {
    return path.join(npm.dir, this.name, this.ver, 'package');
  }
});
github zaach / npm-seal / lib / seal.js View on Github external
Object.keys(wrap.dependencies).forEach(function (depName) {
    _traverseWrap(path.join(npm.dir, depName), depName, wrap.dependencies[depName]);
  });
github apmjs / apmjs / src / utils / npm.js View on Github external
get: () => {
      return path.resolve(npm.dir, '../amd_modules')
    }
  },
github TomFrost / Toady / app / ribbit / Ribbit.js View on Github external
.seq(function makeSymlink() {
			fs.symlink(path.join(npm.dir, modPkg), path.join(MOD_DIR, modId),
				'dir', this);
		})
		.seq(function complete() {