open-docs

1.0.1 • Public • Published

open-docs

Build Status Coverage Status semantic-release Commitizen friendly npm version

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.

Dependents (0)

Package Sidebar

Install

npm i open-docs

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

352 kB

Total Files

7

Last publish

Collaborators

  • jedwards1211