lifecycle-cmd.js 496 B

123456789101112131415161718
  1. exports = module.exports = cmd
  2. var npm = require('../npm.js')
  3. var usage = require('./usage.js')
  4. function cmd (stage) {
  5. function CMD (args, cb) {
  6. npm.commands['run-script']([stage].concat(args), cb)
  7. }
  8. CMD.usage = usage(stage, 'npm ' + stage + ' [-- <args>]')
  9. var installedShallow = require('./completion/installed-shallow.js')
  10. CMD.completion = function (opts, cb) {
  11. installedShallow(opts, function (d) {
  12. return d.scripts && d.scripts[stage]
  13. }, cb)
  14. }
  15. return CMD
  16. }