get-npm-exec-opts.js 378 B

123456789101112131415161718192021
  1. "use strict";
  2. const log = require("npmlog");
  3. module.exports.getNpmExecOpts = getNpmExecOpts;
  4. function getNpmExecOpts(pkg, registry) {
  5. // execa automatically extends process.env
  6. const env = {};
  7. if (registry) {
  8. env.npm_config_registry = registry;
  9. }
  10. log.silly("getNpmExecOpts", pkg.location, registry);
  11. return {
  12. cwd: pkg.location,
  13. env,
  14. pkg,
  15. };
  16. }