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

create-lx-front

v1.0.1-beta5

Published

用于快速生成前端项目的脚手架。执行命令后,会将本仓库的 [template](file:///Users/tangling/Desktop/lx-project-work/create-lx-front/template) 目录完整拷贝为你的新项目,并在新项目根目录写入 `.lx-template.json` 用于后续模版更新。

Readme

create-lx-front

用于快速生成前端项目的脚手架。执行命令后,会将本仓库的 template 目录完整拷贝为你的新项目,并在新项目根目录写入 .lx-template.json 用于后续模版更新。

目录结构

create-lx-front
├─ bin/
│  └─ index.js                 # CLI 入口:创建项目、写入 .lx-template.json
├─ template/                   # 项目模版(会被复制到新项目)
│  ├─ package.json             # 新项目 scripts(含模版更新命令)
│  └─ scripts/
│     └─ lx-template.mjs       # 模版更新实现(生成 patch 并应用)
└─ publish.sh                  # 发布脚本(仅用于发布本 npm 包)

使用

创建项目

npx create-lx-front my-app
cd my-app
pnpm install
pnpm dev

说明:

  • 新项目会生成 .lx-template.json(记录模版来源版本)。
  • 模版项目的 Node / pnpm 版本要求以新项目的 package.json -> engines 为准。

模版更新(已创建的项目如何更新)

新项目内置了以下命令(来自模版的 package.json scripts):

  • 查看当前项目记录的模版版本
pnpm lx:template:info
  • 查看从当前版本到目标版本的模版差异
pnpm lx:template:diff --to 1.0.1-beta3
  • 一键更新模版到目标版本(会自动生成补丁并应用到当前项目)
pnpm lx:template:update --to 1.0.1-beta3

更新原理与要求

更新逻辑位于 lx-template.mjs

  • 从 npm 拉取 create-lx-front@<旧版本>create-lx-front@<新版本> 的 tarball
  • 提取两份包内的 template/ 目录并生成 patch(路径为 a/b/ 前缀)
  • 将 patch 保存到项目根目录:.lx-template.<from>-to-<to>.patch
  • 通过 git apply -p1(可带 --3way)应用到当前项目

为了提升成功率,建议:

  • 新项目初始化 git 并做一次初始提交
  • 更新前确保工作区干净(无未提交改动)

推荐流程:

git init
git add -A
git commit -m "init"
pnpm lx:template:update --to 1.0.1-beta3

常用参数

  • 只生成补丁,不自动应用(适合先审查变更)
pnpm lx:template:update --to 1.0.1-beta3 --dry-run
  • 应用失败时生成 .rej 文件,便于手动合并冲突
pnpm lx:template:update --to 1.0.1-beta3 --reject
  • 禁用 3-way(在某些仓库场景下更可控)
pnpm lx:template:update --to 1.0.1-beta3 --no-3way

老项目没有 .lx-template.json 怎么办

如果项目不是通过新版脚手架创建,可能缺少 .lx-template.json。可以在项目根目录手动补一个最小文件:

{
  "generatorPackage": "create-lx-front",
  "templateVersion": "1.0.1-beta1"
}

然后即可使用 pnpm lx:template:update --to <version> 执行更新。

使用git执行补丁

git apply -p1 默认使用 3-way 合并,如果项目有冲突,可能会导致冲突无法解决。建议在应用前先检查是否有冲突,或在应用前执行 git add -A 确保所有文件都在补丁前。

将 lx:template:diff 命令的输出保存到自定义文件名叫 update.patch 文件,然后使用 git apply -p1 update.patch 应用补丁。