0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npm のライブラリ(モジュール)のドキュメントを見るコマンド

Last updated at Posted at 2022-10-09

探したけどそれっぽいものが見つからないので自前で。
Markdown を CLI で描画する手段を glow というコマンドに依存しているので、事前に brew install などして入れてください。入れたくない場合は glow を less などに置き換えてください。

.bashrc や .zshrc に下記を記述

.bashrc
nodedoc() {
    local readme_path
    if [ -d "node_modules/${1}" ]; then
        readme_path="node_modules/${1}/README.md"
    else
        readme_path="$(npm root -g)/${1}/README.md"
    fi
    glow -p "$readme_path";
}

使い方

nodedoc <package name>

使用例

nodedoc react

image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?