Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add cnpm to corepack#333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
elrrrrrrr wants to merge12 commits intonodejs:main
base:main
Choose a base branch
Loading
fromelrrrrrrr:cnpm
Open

Conversation

@elrrrrrrr
Copy link

@elrrrrrrrelrrrrrrr commentedDec 5, 2023
edited by aduh95
Loading

add cnpm to corepack,closes#331

  1. ✍️ update config.json and add registry information for cnpm.
  2. 🪝 Add apost-install hook to install cnpm-related dependencies.

Fixes:#331

fengmk2 and andriyor reacted with thumbs up emoji
@elrrrrrrrelrrrrrrr changed the titleadd support for cnpmfeat: add cnpm to corepackDec 5, 2023
@aduh95
Copy link
Contributor

2. 🪝 Add apost-install hook to install cnpm-related dependencies.

Could it be possible to drop that and download ready-to-be-used code instead?

elrrrrrrr reacted with rocket emoji

fengmk2 pushed a commit to cnpm/cnpm that referenced this pull requestDec 6, 2023
> 修改构建配置,将 cnpm 运行依赖进行 bundle 处理,seenodejs/corepack#3331. 期望 cnpm 能直接集成在 corepack 中作为 nodejs 预置的包管理器2. 目前其他 pnpm、npm 和 yarn 都会做 bundle 处理,cnpm 由于集成了 npm,只能继续使用 bundleDeps的方式打包corepack 通过 tgz 进行分发, 没有时机执行相关依赖安装。尝试过两种方式进行 bundle:1. ❎ 通过 esbuild,无法处理 require.resolve npm 的场景,考虑到依赖稳定性需要将 npm 一并 bundle2. ✅ 通过 bundleDeps 配置两种方式都需要通过 `npm` mode 进行安装目前 bundle 后 tgz 体积为 `8.7M`,和 pnpm,yarn 相比差距较大 (~2M)
Copy link
Contributor

@aduh95aduh95 left a comment

Choose a reason for hiding this comment

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

You probably want to updatesync.yml so the version of cnpm inconfig.json stays up-to-date

@elrrrrrrrelrrrrrrrforce-pushed thecnpm branch 2 times, most recently from229e83f to966b3ecCompareDecember 7, 2023 11:40
@elrrrrrrrelrrrrrrrforce-pushed thecnpm branch 2 times, most recently from0999d8b to6856b78CompareDecember 8, 2023 03:12
@elrrrrrrrelrrrrrrr marked this pull request as ready for reviewDecember 8, 2023 14:42
@elrrrrrrr
Copy link
Author

Just a gentle ping 🙏🏻@aduh95@arcanis@merceyz
If there's anything more needed from my side, please let me know.
Eagerly awaiting your feedback

@anonrig
Copy link
Member

cc @nodejs/security-wg

Copy link
Member

@legendecaslegendecas left a comment

Choose a reason for hiding this comment

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

I confirm that cnpm is a helpful alternative to npm in China where registry.npmjs.org may be hardly reachable for common users.https://registry.npmmirror.com is a mirror of registry.npmjs.org for users based in China to get better access to npm packages.

It would definitely help users get started with Node.js and install npm dependencies in China.

I support adding cnpm and npmmirror.com to corepack.

elrrrrrrr and fengmk2 reacted with heart emoji
elrrrrrrrand others added5 commitsDecember 14, 2023 21:39
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@joyeecheung
Copy link
Member

joyeecheung commentedDec 14, 2023
edited
Loading

Can't review the code per-se myself, but I can also confirm that cnpm is a trust-worthy alternative primarily sponsored by Alibaba to help Node.js developers in China work around the network issues in the public network in China & create private registries within a company.

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
@arcanis
Copy link
Contributor

arcanis commentedDec 15, 2023
edited
Loading

I'm not familiar with cnpm, so couple of questions:

  • What makes cnpm more useful than setting a custom registry in one's configuration? Why does a whole package manager need to be built around that (rather than configure the local mirror)?

  • Does it mean that the cnpm default registry is subject to local CN legislation? Is it potentially a problem to provide that in the default Node.js installs (note that I'd have the same question if we were to change, say, pnpm to a EU mirror)?

  • Is it a wrapper around npm with a different registry? I see you implemented a similar install strategy as pnpm; are there other differencies?

styfle reacted with eyes emoji

@elrrrrrrr
Copy link
Author

elrrrrrrr commentedDec 15, 2023
edited
Loading

@arcanis

Thank you for your interest and questions about cnpm. I am pleased to provide you with the following clarifications:

Why does a whole package manager need to be built around

Indeed, we offer a complete read-only mirror service capability. Developers can directly configure the registry address and use yarn, pnpm, or any package manager of their choice. However, we still provide an independent client, mainly to handle the following scenarios:

Does it mean that the cnpm default registry is subject to local CN legislation

Like all websites accessible within China, cnpm aligns with the country's internet and data regulations. For over 10 years, it has been reliably serving users while adhering to Mainland China's regulatory requirements. This compliance ensures that cnpm's default registry undergoes thorough network filing and security scanning, aligning with local policy standards. Our commitment is to provide reliable and compliant services to developers, not just in China but globally, always mindful of the legal nuances in different regions.

Are there other differencies?

cnpm includes npm to ensure maximum compatibility. In the corporate environment, we also offer some extended capabilities. We continue to advance related open-source work, including:

  • Providing faster dependency resolution. Changes on the registry side have been released, allowing the registry to directly parse semver expressions:https://registry.npmmirror.com/node/>=16 < 20
  • Offering the fastest dependency installer, rapid, available athttps://github.com/cnpm/rapid. (currently beta)
  • Installing custom node runtime environments for projects through the package manager.

These features, in addition to changes on the registry side, also require client-side adaptation.

Please let me know if you have any further questions or need more information. 🙏🏻

@aduh95aduh95 mentioned this pull requestJan 31, 2024
@aladdin-add
Copy link

Whether or not to support setting registry tohttps://registry.npmmirror.com/ when not using cnpm?

"versions":"versions",
"tags":"dist-tags"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably provide mentioned for the npm package, see#339

Suggested change
}
},
"npmRegistry": {
"type":"npm",
"package":"cnpm"
},

Comment on lines 5 to +8
Npm=`npm`,
Pnpm=`pnpm`,
Yarn=`yarn`,
Cnpm=`cnpm`,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: ASCII/alphabetical order

Suggested change
Npm=`npm`,
Pnpm=`pnpm`,
Yarn=`yarn`,
Cnpm=`cnpm`,
Cnpm=`cnpm`,
Npm=`npm`,
Pnpm=`pnpm`,
Yarn=`yarn`,

@zanminkian
Copy link
Contributor

It seems cnpm is not actively maintaining. The future of cnpm is not very clear.

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

Reviewers

@anonriganonriganonrig left review comments

@merceyzmerceyzmerceyz requested changes

@aduh95aduh95aduh95 approved these changes

@legendecaslegendecaslegendecas approved these changes

@arcanisarcanisAwaiting requested review from arcanis

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Application to Include cnpm in corepack

10 participants

@elrrrrrrr@aduh95@anonrig@joyeecheung@arcanis@aladdin-add@zanminkian@merceyz@legendecas@actions-user

[8]ページ先頭

©2009-2025 Movatter.jp