mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 19:07:23 +00:00

PR-URL: https://github.com/nodejs/node/pull/43061 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
20 lines
447 B
JavaScript
20 lines
447 B
JavaScript
const PackageUrlCmd = require('../package-url-cmd.js')
|
|
class Docs extends PackageUrlCmd {
|
|
static description = 'Open documentation for a package in a web browser'
|
|
static name = 'docs'
|
|
|
|
getUrl (spec, mani) {
|
|
if (mani.homepage) {
|
|
return mani.homepage
|
|
}
|
|
|
|
const info = this.hostedFromMani(mani)
|
|
if (info) {
|
|
return info.docs()
|
|
}
|
|
|
|
return `https://www.npmjs.com/package/${mani.name}`
|
|
}
|
|
}
|
|
module.exports = Docs
|