npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lrk-hello-cli

v1.0.1

Published

一个用于学习 npm 包生命周期的 CLI 示例项目

Readme

lrk-hello-cli

一个用于学习 npm 包完整生命周期的 CLI 示例项目。

功能特性

  • 🎉 greet - 向用户打招呼,支持自定义颜色和大小写
  • ℹ️ info - 显示系统和包信息
  • 📝 create - 创建示例文件(支持 txt、json、md 格式)
  • 📂 list - 列出目录中的文件

安装

全局安装

npm install -g lrk-hello-cli

本地测试

# 克隆项目
git clone <repository-url>
cd lrk-hello-cli

# 安装依赖
npm install

# 链接到全局
npm link

# 现在可以使用 hello-cli 命令了
hello-cli --version

查看已链接的本地包

# 查看全局已链接的包
npm ls -g --depth=0 --link

取消本地链接

# 取消全局链接
npm unlink -g lrk-hello-cli

# 或者先进入项目目录
npm unlink

使用方法

查看版本

hello-cli --version

查看帮助

hello-cli --help

命令详解

1. greet - 打招呼

# 基本用法
hello-cli greet

# 指定名字
hello-cli greet 小明

# 大写输出
hello-cli greet 小明 --uppercase

# 指定颜色(支持 red, green, yellow, blue, magenta, cyan)
hello-cli greet 小明 --color blue
hello-cli greet 小明 -c red

2. info - 系统信息

hello-cli info

输出示例:

=== 系统信息 ===
Node.js 版本: v18.12.1
平台: darwin
架构: arm64

=== 包信息 ===
包名: lrk-hello-cli
版本: 1.0.0
描述: 一个用于学习 npm 包生命周期的 CLI 示例项目
作者: Your Name
许可证: MIT

3. create - 创建文件

# 创建文本文件(默认)
hello-cli create myfile

# 创建 JSON 文件
hello-cli create myfile --template json
hello-cli create myfile -t json

# 创建 Markdown 文件
hello-cli create myfile --template md

4. list - 列出文件

# 列出当前目录
hello-cli list

# 列出指定目录
hello-cli list /path/to/dir

# 显示隐藏文件
hello-cli list --all
hello-cli list -a

发布到 npm

1. 准备工作

确保你有一个 npm 账号:

npm adduser
# 或登录已有账号
npm login

2. 检查包配置

# 检查包信息
npm pack

# 查看将被发布的文件
npm publish --dry-run

3. 发布

# 发布公开包
npm publish --access public

# 如果包名已被占用,可以使用作用域
npm publish --access public --scope=@yourname

4. 更新版本

# 补丁版本 (1.0.0 -> 1.0.1)
npm version patch

# 次要版本 (1.0.0 -> 1.1.0)
npm version minor

# 主要版本 (1.0.0 -> 2.0.0)
npm version major

# 发布后记得推送标签
git push --tags

卸载

全局卸载

npm uninstall -g lrk-hello-cli

验证卸载

# 检查命令是否还存在
hello-cli --version  # 应该显示 command not found

项目结构

lrk-hello-cli/
├── bin/
│   └── cli.js          # CLI 入口文件
├── package.json        # 包配置
├── README.md          # 项目文档
└── .gitignore         # Git 忽略配置

依赖说明

许可证

MIT

学习资源