bin.js 575 B

12345678910111213141516171819202122232425262728
  1. const envPath = require('./utils/path.js')
  2. const BaseCommand = require('./base-command.js')
  3. class Bin extends BaseCommand {
  4. static get description () {
  5. return 'Display npm bin folder'
  6. }
  7. static get name () {
  8. return 'bin'
  9. }
  10. static get params () {
  11. return ['global']
  12. }
  13. exec (args, cb) {
  14. this.bin(args).then(() => cb()).catch(cb)
  15. }
  16. async bin (args) {
  17. const b = this.npm.bin
  18. this.npm.output(b)
  19. if (this.npm.config.get('global') && !envPath.includes(b))
  20. console.error('(not in PATH env variable)')
  21. }
  22. }
  23. module.exports = Bin