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

@lhx-kit/cli

v1.2.1

Published

lhx-kit CLI: scaffold real-world MPA projects with create / add / dev / build / info / doctor / offline / upgrade commands.

Readme

@lhx-kit/cli

⚙️ lhx-cli — 一条命令生成真正可上生产的 MPA 项目。 不是"hello world + Vite",而是第一天就有路由、状态、请求、Mock、CI、Docker、测试的完整项目

npm license English


安装

# 全局安装
pnpm add -g @lhx-kit/cli

# 或一次性使用(不安装)
pnpm dlx @lhx-kit/cli create my-app

需要 Node.js >= 18.18.0

快速开始

lhx-cli create my-app
cd my-app
pnpm install && pnpm dev

命令总览

| 命令 | 用途 | | --- | --- | | lhx-cli create <name> | 🚀 脚手架创建新项目 | | lhx-cli add page <name> | ➕ 增量添加 page(entry / router / render.json / views) | | lhx-cli dev [--page] | 🧪 启动 Vite 开发服务器 | | lhx-cli build [--page] | 🏗️ 生产构建 | | lhx-cli info | 📊 打印项目配置摘要 | | lhx-cli doctor | 🩺 诊断环境与配置 | | lhx-cli offline <action> | 📦 离线包(build\|manifest\|inspect) | | lhx-cli upgrade | ⬆️ 升级项目(规划中) |

完整参数参考:CLI 文档


示例

交互式创建

lhx-cli create my-app
# ? 选择模板                  · react-mpa
# ? 启用哪些 feature?         · offline, mock, e2e
# ? 包管理器                   · pnpm
# ? 是否 git init?            · yes
# ? 是否立即安装依赖?          · yes

非交互(CI 友好)

lhx-cli create my-app \
  --template=react-mpa \
  --features=offline,e2e,mock \
  --pm=pnpm \
  --yes

一键生成完整页面

lhx-cli add page profile
# ✓ src/pages/profile/entry.tsx
# ✓ src/pages/profile/router.tsx
# ✓ src/pages/profile/render.json
# ✓ src/pages/profile/views/ProfileLanding.tsx
# ✓ src/pages/profile/views/ProfileAbout.tsx
# ✓ project.config.ts 通过 AST (ts-morph) 插入新字段

诊断配置问题

lhx-cli doctor
# ✅ Node.js 20.18.0
# ✅ pnpm 9.15.0
# ✅ project.config.ts schema
# ❌ LHX_E001: page "profile" 已声明但 src/pages/profile/entry.tsx 不存在
#    修复:lhx-cli add page profile 或从 project.config.ts 删除

模板

内置两套生产级模板:

| 模板 | 框架 | 状态管理 | UI 库 | 路由 | | --- | --- | --- | --- | --- | | 🟢 vue3-mpa | Vue 3.5 | Pinia | Vant 4 | vue-router 4 | | 🔵 react-mpa | React 19 | Zustand 5 | Ant Design 5 | react-router 6 |

两套模板都自带:ESLint + Prettier + Husky + Commitlint + lint-staged + Vitest + Playwright + MSW + Docker + GitHub Actions


设计

AST 级配置改写

lhx-cli add page 不用正则或字符串拼接,用 ts-morph 解析 project.config.ts,在 AST 层找到 pages 节点,插入新的 PropertyAssignment

效果:你已有的注释 / 缩进 / 格式完整保留

本地模板(无需联网)

模板随 CLI 包一起发布(packages/cli/templates/)。运行时不拉 GitHub,不依赖 registry,离线可用

基于 cac 的命令路由

~15KB 的轻量命令解析器。不预加载所有命令模块——lhx-cli --help 只需 <50ms,因为子命令按需 lazy load。


依赖

| 依赖 | 用途 | | --- | --- | | cac | 命令路由(体积最小 / 最快) | | prompts | 交互式问答 | | kolorist | 终端着色 | | execa | 跨平台子进程(pnpm installgit init) | | fs-extra | copy / remove / ensureDir | | jiti | 加载用户的 project.config.ts | | ts-morph | AST 级配置改写 | | giget | 预留用于未来的远端模板拉取 | | @lhx-kit/config | 配置 schema + loader | | @lhx-kit/offline | offline 子命令实现 |


文档

License

MIT © luhanxin


📦 安装

npm install @lhx-kit/cli
# 或
pnpm add @lhx-kit/cli

npm provenance

📖 文档与延伸阅读

🤝 参与贡献

欢迎 PR!请阅读 CONTRIBUTING.md,用户可见变更请用 pnpm changeset 声明。新手友好 label:good first issue / help wanted

📄 License

MIT © luhanxin

属于 @lhx-kit monorepo。每次发布都经过 npm Trusted Publishing(OIDC)签名——可在 npm 包页面验证 provenance 证明。