Skip to main content

pnpm 的2022年

· 6 min read
Zoltan Kochan
Lead maintainer of pnpm

这一年即将结束。真是艰难的一年。正如你可能知道的,我住在乌克兰,所以由于俄罗斯对我们的战争,今年比往年更难推动这个项目。尽管如此,这对 pnpm 来说是很好的一年。我们获得了许多新用户和贡献者,并且实现了许多很棒的功能。

🌐 It is the end of the year. A really hard year. As you may know, I live in Ukraine, so due to Russia's war against us, it was harder to lead this project than in previous years. Nevertheless, it was a good year for pnpm. We've got a lot of new users, contributors, and we have implemented many great features.

(上述插图由 Midjourney 生成。老虎象征虎年)

用法

🌐 Usage

下载统计

🌐 Download Stats

我今年的目标是通过下载量超过 Lerna。我们能够在 八月 实现这个目标:

🌐 My goal this year was to beat Lerna by the number of downloads. We were able to achieve this goal in August:

在 2022 年,pnpm 的下载量比 2021 年多出 5 倍以上

🌐 pnpm was downloaded more than 5 times more in 2022 than in 2021:

查看文档

🌐 Docs visits

我们通过 Google Analytics 从我们的文档中收集一些非个性化的统计数据。 2022 年,我们有时每周的独立访客超过 20,000 人。这是 2021 年的 10 倍!

🌐 We collect some unpersonalized stats from our docs using Google Analytics. In 2022, sometimes we had more than 20,000 unique visitors a week. This is 10 times more than in 2021!

GitHub 星标

🌐 GitHub stars

我们的主要 GitHub 仓库今年获得了将近 7,000 颗星。

🌐 Our main GitHub repository received almost +7,000 stars this year.

我们的贡献者

🌐 Our contributors

今年我们有很多新的活跃贡献者。这些是在2022年合并至少一个PR的人:

🌐 We had a lot of new and active contributors this year. These are the people the merge at least one PR in 2022:

功能亮点

🌐 Feature Highlights

支持无符号链接提升的 node_modules(自 v6.25.0 起)

🌐 Supporting a symlinkless hoisted node_modules (since v6.25.0)

在2022年一开始,我们就增加了对“传统”提升(又名平铺 node_modules)的支持。我们使用 Yarn 的提升算法来创建一个合适的提升 node_modules。这个新设置基本上使 pnpm 兼容所有与 npm CLI 兼容的 Node.js 堆栈。

🌐 Right at the beginning of 2022, we have added support for the "traditional" hoisted (a.k.a flat node_modules). We use Yarn's hoisting algorithm to create a proper hoisted node_modules. This new setting has basically made pnpm compatible with all Node.js stack that are compatible with npm CLI.

要使用提升的 node_modules 目录结构,请在 .npmrc 文件中使用 node-linker=hoisted 设置。

🌐 To use the hoisted node_modules directory structure, use the node-linker=hoisted setting in an .npmrc file.

副作用缓存(自 v7.0.0 起)

🌐 Side effects cache (since v7.0.0)

自 v7 起,side-effect-cache 默认启用,因此应构建的依赖在一台机器上只构建一次。这在具有构建脚本依赖的项目中大大提高了安装速度。

🌐 Since v7, side-effect-cache is enabled by default, so dependencies that should be built are only built once on a machine. This improves installation speed by a lot in projects that have dependencies with build scripts.

依赖修补(自 v7.4.0 起)

🌐 Dependencies patching (since v7.4.0)

[pnpm patch] 命令已被添加,用于修补你 node_modules 中的依赖。

🌐 The pnpm patch command have been added for patching dependencies in your node_modules.

基于时间的解析策略(自 v7.10.0 起)

🌐 Time-based resolution strategy (since v7.10.0)

pnpm 增加了一种新的解析模式,这应该会使更新依赖更安全。你可以通过 resolution-mode 设置更改解析模式。

🌐 A new resolution mode was added to pnpm, which should make updating dependencies more secure. You can change the resolution mode with the resolution-mode setting.

列出依赖的许可证(自 v7.17.0 起)

🌐 Listing licenses of dependencies (since v7.17.0)

你现在可以使用 pnpm licenses list 命令来检查已安装软件包的许可证。

🌐 You may now use the pnpm licenses list command to check the licenses of the installed packages.