npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

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.

install

npm i open-docs

Downloadsweekly downloads

1

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability