root.js 592 B

1234567891011121314151617181920212223242526
  1. const BaseCommand = require('./base-command.js')
  2. class Root extends BaseCommand {
  3. /* istanbul ignore next - see test/lib/load-all-commands.js */
  4. static get description () {
  5. return 'Display npm root'
  6. }
  7. /* istanbul ignore next - see test/lib/load-all-commands.js */
  8. static get name () {
  9. return 'root'
  10. }
  11. /* istanbul ignore next - see test/lib/load-all-commands.js */
  12. static get params () {
  13. return ['global']
  14. }
  15. exec (args, cb) {
  16. this.root(args).then(() => cb()).catch(cb)
  17. }
  18. async root () {
  19. this.npm.output(this.npm.dir)
  20. }
  21. }
  22. module.exports = Root