Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 使用corepack管理PNM版本,锁定为[email protected],增加ci脚本支持快速下载依赖 #4237

Closed
wants to merge 4 commits into from

Conversation

mmdapl
Copy link
Contributor

@mmdapl mmdapl commented Dec 19, 2024

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (v4-next@b504366). Learn more about missing BASE report.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             v4-next    #4237   +/-   ##
==========================================
  Coverage           ?   85.74%           
==========================================
  Files              ?      512           
  Lines              ?    48078           
  Branches           ?     4785           
==========================================
  Hits               ?    41224           
  Misses             ?     6825           
  Partials           ?       29           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@waitingsong
Copy link
Member

为啥要指定 pnpm 呢?

@mmdapl
Copy link
Contributor Author

mmdapl commented Dec 19, 2024

为啥要指定 pnpm 呢?

这里的pnpm你们可以自行确定。 主要是避免拉下来时,pnpm版本不一致,pnpm-lock的配置更新,锁包版本。保证开发环境一致

@waitingsong
Copy link
Member

waitingsong commented Dec 19, 2024

我意思是为啥要指定包管理器 pnpm 而不是 npm 或者其它呢? 不是所有人都使用 pnpm 吧。

scripts/ci Outdated
##

# NPM源
NPM_REGISTRY="https://mirrors.tencent.com/npm/"
Copy link
Member

Choose a reason for hiding this comment

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

不允许使用三方源,避免同步问题

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我改成淘宝源可以嘛? 得考虑国内开发者下载速度吧,或者不指定我就删了吧

Copy link
Member

@czy88840616 czy88840616 Dec 19, 2024

Choose a reason for hiding this comment

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

不需要的,这里仅考虑 CI 标准环境,本地的可以自行配置 registry,或者 nrm 修改,方式有很多,也没法限制,不需要提交的。

scripts/ci Outdated
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY && corepack enable pnpm

# 安装项目依赖
pnpm i --registry $NPM_REGISTRY --frozen-lockfile "$@"
Copy link
Member

Choose a reason for hiding this comment

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

这里其实不需要 --frozen-lockfile,因为 pnpm 在 github action ci 环境默认就是这个

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个脚本,可以直接用,免得在本地pnpm i 。 直接pnpm i,pnpm-lock不就会更新嘛?

Copy link
Member

@czy88840616 czy88840616 Dec 19, 2024

Choose a reason for hiding this comment

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

如果 lock 里没有,那 i 的时候更新也没问题的,pr 的时候会看的。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我是习惯于把环境配置好,争取做到开发者不因为环境导致问题,专注与业务上。 我经常在pnpm i时出现pnpm-lock变动,PR提交上来了。就得反复改。

如果觉得不太合适,我明天把这个PR 关掉

Copy link
Member

Choose a reason for hiding this comment

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

恩,这个 pr 更多的是一些开发者习惯,目前看起来还不足以变成框架的规约。

pnpm i 在新增依赖,更新了 package.json 和 lock 文件,这是合理的,如果没有更新,纯粹只是安装,应该不会更新 pkg 和 lock。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pnpm i直接安装会更新pnpm-lock,但不更新pkg, 因为pkg里面的版本,很多有 "@types/node": "^2.10.2", 这种。 目前midway好像是写死版本号

Copy link
Member

Choose a reason for hiding this comment

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

是的,每个三方包都会经由renovate 机器人提 pr 后人工 review + CI 完后合入。

@@ -87,7 +87,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
version: 9.6.0
Copy link
Member

Choose a reason for hiding this comment

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

为什么是这个版本呢,pnpm 应该没有出现过 minor 版本不兼容的情况吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

因为我本地使用的是9.6.0 那我改成9吧

Copy link
Member

@czy88840616 czy88840616 Dec 19, 2024

Choose a reason for hiding this comment

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

我理解 9 的 latest 就行了。如果 pnpm 有问题,由 CI + lock 来保证,我们最终确保的是框架 ci 没有问题,这个 lock 仅服务于框架本身,不会提供给用户的项目。

@czy88840616
Copy link
Member

czy88840616 commented Dec 19, 2024

为啥要指定 pnpm 呢?

这个没问题,v4 本身是用 pnpm 开发的。

@mmdapl mmdapl closed this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants