npm docs
(npm home
)
ホームページを開く。
$ npm docs # カレントディレクトリのパッケージ
$ npm docs eslint @types/node # 複数パッケージを指定可能
npm repo
リポジトリページを開く。
$ npm repo # カレントディレクトリのパッケージ
$ npm repo eslint # パッケージを1つだけ指定可能
npm bugs
(npm issues
)
issue ページを開く。
$ npm bugs # カレントディレクトリのパッケージ
$ npm bugs eslint # パッケージを1つだけ指定可能
以下の Bash 関数は不要で、npm 標準のコマンドのみで実現できた…
インストール
~/.bashrc
に npm-open
関数を追加する。
~/.bashrc
# Usage: npm-open <package>
function npm-open() {
[ -n "$1" ] && npm info "$1" homepage repository.url | head -1 | cut -d ' ' -f 3 | xargs open
}
使い方
$ npm-open eslint # homepage URL
$ npm-open @types/node # repository URL
Gist
Open NPM package's URL
https://gist.github.com/ybiquitous/31a7f54216cdd2a53d194efac93f7a29