lifecycle.js 851 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict'
  2. const npm = require('../npm.js')
  3. const log = require('npmlog')
  4. module.exports = lifecycleOpts
  5. let opts
  6. function lifecycleOpts (moreOpts) {
  7. if (!opts) {
  8. opts = {
  9. config: npm.config.snapshot,
  10. dir: npm.dir,
  11. failOk: false,
  12. force: npm.config.get('force'),
  13. group: npm.config.get('group'),
  14. ignorePrepublish: npm.config.get('ignore-prepublish'),
  15. ignoreScripts: npm.config.get('ignore-scripts'),
  16. log: log,
  17. nodeOptions: npm.config.get('node-options'),
  18. production: npm.config.get('production'),
  19. scriptShell: npm.config.get('script-shell'),
  20. scriptsPrependNodePath: npm.config.get('scripts-prepend-node-path'),
  21. unsafePerm: npm.config.get('unsafe-perm'),
  22. user: npm.config.get('user')
  23. }
  24. }
  25. return moreOpts ? Object.assign({}, opts, moreOpts) : opts
  26. }