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

kht-cli-dev

v1.0.10

Published

lerna init

Readme

1、初始化 lerna

lerna init

2、创建包

lerna create <name>

2)、登录npm网站,创建npm 包名kht-cli-dev

3、安装依赖包

    1、全局安装
        lerna add

    2)、给指定的包安装依赖
        lerna add @kht-cli-dev/utils packages/core/      (本地包之间也可以)
        本地包安装完后运行 lerna link 生成软连接

4、清空依赖
lerna clean


5、lerna link




//删除所有子包的node_modules

lerna exec -- rm -rf node_modules/

//执行指定子包的脚本

lerna exec --scope 子包目录 -- 操作


lerna changed

git add =>push

lerna diff

version:当前版本 npmClient:指定运行命令的客户端,设定为"yarn"则使用 yarn 运行,默认值是"npm"。 command.publish.ignoreChanges:通配符的数组,其中的值不会被 lerna 监测更改和发布,使用它可以防止因更改发布不必要的新版本。 command.publish.message:执行发布版本更新时的自定义提交消息。 command.publish.registry:使用它来设置要发布的自定义注册 url,而非 npmjs.org。 command.bootstrap.ignore:运行 lerna bootstrap 指令时会忽视该字符串数组中的通配符匹配的文件。 command.bootstrap.npmClientArgs:该字符串数组中的参数将在 lerna bootstrap 命令期间直接传递给 npm install。 command.bootstrap.scope:该通配符的数组会在 lerna bootstrap 命令运行时限制影响的范围。 packages :表示包位置的全局变量数组。

除了上面的 init 命令外,项目使用过程中还会用到很多其他有用的命令。

lerna create:此命令的作用是用来创建一个子包名为 xx 的项目。 lerna add:此命令用于安装依赖,格式为 lerna add [@version] [–dev]。 lerna list:查看当前包名列表。 lerna link:将所有相互依赖的包符号链接在一起。 lerna exec:在每个包中执行任意命令。 lerna run:在每个包中运行 npm 脚本如果该包中存在该脚本。

1、在 module-a 中引入 module-b,module-a 代码如下。

// module-a 'use strict'; const moduleB = require('module-b'); console.log('moduleB:', moduleB());

module.exports = moduleA;

function moduleA() { return 'it's module a'; }

2、module-b 的代码如下。 // module-b 'use strict';

module.exports = moduleB;

function moduleB() { return 'it's module b'; }

此时,我们运行 node packages/module-a/lib/module-a.js 可能会报错,提示找不到 module-b 模块,这是因为我们还没在 moduleA 中安装依赖,需要使用下面的命令安装依赖

lerna add module-b --scope=module-a

可以看到,module-a node_modules 目录下安装了 module-b 包,重新运行上面的 module-a 代码会输出如下内容。

$ node packages/module-a/lib/module-a.js
moduleB: it's module b

"command": { "publish": { "ignoreChanges": ["ignored-file", "*.md"], "message": "chore(release): publish", "registry": "https://npm.pkg.github.com" }, "bootstrap": { "ignore": "component-*", "npmClientArgs": ["--no-package-lock"] } }