• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const PackageUrlCmd = require('../package-url-cmd.js')
2class Docs extends PackageUrlCmd {
3  static description = 'Open documentation for a package in a web browser'
4  static name = 'docs'
5
6  getUrl (spec, mani) {
7    if (mani.homepage) {
8      return mani.homepage
9    }
10
11    const info = this.hostedFromMani(mani)
12    if (info) {
13      return info.docs()
14    }
15
16    return `https://www.npmjs.com/package/${mani.name}`
17  }
18}
19module.exports = Docs
20