open Github repo pages for npm modules in your browser
Install
npm install openg
Requires Node.js 20 or newer.
Usage
const openg = require('openg');openg();//=> returns a promise that opens the github page for the current directory in-browseropeng('express');//=> returns a promise that opens the github page for express in-browseropeng(['inf', 'sist', 'openg'], { issues: true});//=> returns a promise that opens the github issues pages for all in-browser
API
openg(target, [opts])
target
Type: string | array
npm modules name(s) you want to open in your browser
Urls come from the module's homepage (or bugs.url with issues: true). When
those are missing — which is common — they are inferred from the repository
field instead, including the subdirectory for packages published out of a
monorepo. Every form npm allows is understood: "user/repo" shorthand, a bare
url, or an object using git:, git+ssh:, or https:.
Called with no target, openg answers for the repo you're standing in, reading
the local checkout rather than the registry: the local package.json first, then
the git remote. Unpublished and private repos work, and no network request is
made unless neither of those resolves.
opts
Type: optionalobject
Pass these in to modify the behavior of openg
issues: true
Open the GitHub issues page for specified repo(s)
dryRun: true
Return the url's that would be opened and do not open them in-browser
Resolves with an array of url value(s), in the same order as target.
Every module is attempted, so one bad name does not stop the others from
opening. If any of them fail, the promise rejects with an
AggregateError
whose .errors holds one error per failed module.