How to use the npm.cache 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 arikon / npm2debian / lib / cli.js View on Github external
var dh_make = function(dir, ctx) {
    var d = Q.defer(),
        tplDir = ctx.versioned? 'debian-npm-ver' : 'debian-npm',
        cmd = [
            BIN.dh_make,
            //'--cdbs',
            '--defaultless',
            '--templates', PATH.resolve(__dirname, '..', tplDir),
            '--packagename', ctx.debianName,
            //'--copyright', 'gpl', // TODO
            '--createorig',
            '--file', PATH.resolve(NPM.cache, ctx.pkg, ctx.ver, 'package.tgz')
        ].join(' '),
        opts = { cwd: dir, env: process.env };

    console.log(cmd);

    var child = CP.exec(cmd, opts, function(err, stdout, stderr) {
        err? d.reject(err) : d.resolve();
    });
    child.stdin.write('\n');

    return d.promise;
};
github zaach / npm-seal / lib / seal.js View on Github external
function _traverseWrap (depPath, name, dep) {
    toHash++;
    var data = localJson(path.join(depPath));
    var sha = getShasum(npm.cache || cacheDir, name, dep.version);
    hashCB(null, name, dep, sha);

    if (dep.dependencies) {
      Object.keys(dep.dependencies).forEach(function (depName) {
        // skip bundled bependencies, the sha of the parent covers these
        if (data.bundleDependencies && data.bundleDependencies.indexOf(depName) >= 0) return;
        _traverseWrap(path.join(depPath, 'node_modules', depName), depName, dep.dependencies[depName]);
      });
    }
    if (--toHash === 0) {
      endCB(null, wrap);
    }
  }
}
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 apache / cordova-lib / cordova-lib / src / util / npm-helper.js View on Github external
function (info) {
                        var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
                        var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');

                        return unpack.unpackTgz(packageTGZ, packageDir);
                    }
                );
github apache / cordova-lib / src / util / npm-helper.js View on Github external
function (info) {
                        var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
                        var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');

                        return unpack.unpackTgz(packageTGZ, packageDir);
                    }
                );
github arikon / npm2debian / lib / source.js View on Github external
cache.read(pkg, ver, function (er, data) {
        if (er) return log.er(cb, "Could not read data for "+pkg+"@"+ver)(er);
        unpackTar(path.join(npm.cache, pkg, ver, "package.tgz"), unpackTarget, cb);
    })
}
github apache / cordova-lib / cordova-lib / src / util / npm-helper.js View on Github external
function (info) {
                        var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
                        var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');

                        return unpack.unpackTgz(packageTGZ, packageDir);
                    }
                );
github apache / cordova-lib / src / util / npm-helper.js View on Github external
function (info) {
                        var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
                        var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');

                        return unpack.unpackTgz(packageTGZ, packageDir);
                    }
                );
github apache / cordova-lib / cordova-lib / src / cordova / lazy_load.js View on Github external
}).then(function(info) {
        var pkgDir = path.resolve(npm.cache, info.name, info.version, 'package');
        return pkgDir;
    });
}