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>
34 lines
815 B
JavaScript
34 lines
815 B
JavaScript
const PackageUrlCmd = require('../package-url-cmd.js')
|
|
|
|
class Bugs extends PackageUrlCmd {
|
|
static description = 'Report bugs for a package in a web browser'
|
|
static name = 'bugs'
|
|
|
|
getUrl (spec, mani) {
|
|
if (mani.bugs) {
|
|
if (typeof mani.bugs === 'string') {
|
|
return mani.bugs
|
|
}
|
|
|
|
if (typeof mani.bugs === 'object' && mani.bugs.url) {
|
|
return mani.bugs.url
|
|
}
|
|
|
|
if (typeof mani.bugs === 'object' && mani.bugs.email) {
|
|
return `mailto:${mani.bugs.email}`
|
|
}
|
|
}
|
|
|
|
// try to get it from the repo, if possible
|
|
const info = this.hostedFromMani(mani)
|
|
if (info) {
|
|
return info.bugs()
|
|
}
|
|
|
|
// just send them to the website, hopefully that has some info!
|
|
return `https://www.npmjs.com/package/${mani.name}`
|
|
}
|
|
}
|
|
|
|
module.exports = Bugs
|