Skip to content

feat: bundle deps of cnpm#428

Merged
fengmk2 merged 2 commits intomasterfrom
bundle
Dec 6, 2023
Merged

feat: bundle deps of cnpm#428
fengmk2 merged 2 commits intomasterfrom
bundle

Conversation

@elrrrrrrr
Copy link
Copy Markdown
Member

修改构建配置,将 cnpm 运行依赖进行 bundle 处理,see nodejs/corepack#333

  1. 期望 cnpm 能直接集成在 corepack 中作为 nodejs 预置的包管理器
  2. 目前其他 pnpm、npm 和 yarn 都会做 bundle 处理,cnpm 由于集成了 npm,只能继续使用 bundleDeps 的方式打包

corepack 通过 tgz 进行分发, 没有时机执行相关依赖安装。

尝试过两种方式进行 bundle:

  1. ❎ 通过 esbuild,无法处理 require.resolve npm 的场景,考虑到依赖稳定性需要将 npm 一并 bundle
  2. ✅ 通过 bundleDeps 配置

两种方式都需要通过 npm mode 进行安装

目前 bundle 后 tgz 体积为 8.7M,和 pnpm,yarn 相比差距较大 (~2M)

@elrrrrrrr elrrrrrrr added enhancement dependencies Pull requests that update a dependency file labels Dec 6, 2023
@elrrrrrrr elrrrrrrr requested a review from fengmk2 December 6, 2023 08:53
"cross-spawn",
"giturl",
"ini",
"npm",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最大的就是 npm 本身

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

npm 的 bundleDeps 没法提升,npminstall 里依赖的时候又重新安装了一遍

感觉也也没啥好办法..

@fengmk2 fengmk2 merged commit 8cd53c0 into master Dec 6, 2023
@fengmk2 fengmk2 deleted the bundle branch December 6, 2023 13:34
fengmk2 pushed a commit that referenced this pull request Dec 6, 2023
[skip ci]

## [9.3.0](v9.2.0...v9.3.0) (2023-12-06)

### Features

* bundle deps of cnpm ([#428](#428)) ([8cd53c0](8cd53c0))
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 6, 2023

🎉 This PR is included in version 9.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants