1.0.1 • Published 6 years ago
open-docs v1.0.1
open-docs
Opens a package's homepage in your preferred browser, but if the package is installed locally, and has no homepage or the homepage is just a README, opens the local copy of its README.md in your preferred editor instead.
Install
npm install --global open-docs
CLI
open-docs react
# opens the homepage for react
open-docs p-timeout
# if p-timeout is installed locally, opens its README.md from the local copy.
# otherwise, opens the homepage for p-timeout (which is just README.md on GitHub)
Node.js API
getManpage(query: string | {cwd: string, packageName: string}): string
const { getManpage } = require('open-docs')
const reactManpage = getManpage('react')
const pTimeoutLocal = getManpage({
cwd: '/my-project',
packageName: 'p-timeout',
})
query: string | {cwd: string, packageName: string}
Either the package name as a string, or an object with the package name, and
the working directory (cwd
) to search for a locally installed copy within
Returns
A URL to the package's homepage, or otherwise a path to the package's
README.md
if it is installed under ${cwd}/node_modules
. If the package is
not found, throws an Error
.
1.0.1
6 years ago