-
Notifications
You must be signed in to change notification settings - Fork 79
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
fix: incorrect latest tag in strict specific version #610
Conversation
hezhengxu2018
commented
Nov 7, 2023
- 添加新建任务时的重复版本校验,去除执行任务时的版本去重
- 在strictSyncSpecificVersion开启时,修改为从可用版本中选择latestTag。之前从任务的指定版本中生成latestTag逻辑不正确
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #610 +/- ##
==========================================
- Coverage 97.45% 96.83% -0.62%
==========================================
Files 168 180 +12
Lines 15691 17548 +1857
Branches 2018 2285 +267
==========================================
+ Hits 15291 16993 +1702
- Misses 400 555 +155 ☔ View full report in Codecov by Sentry. |
let latestStableVersion: string; | ||
const sortedVersionList = specificVersions.sort(semverRcompare); | ||
latestStableVersion = sortedVersionList.filter(i => !semverPrerelease(i))[0]; | ||
let latestStableVersion = semver.maxSatisfying(sortedAvailableVersions, '*'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sortedAvaiableVersions
和 maxStatisfying
感觉保留一个就行?
现在 sortedAvailableVersions 还会用在日志输出里。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sortedAvailableVersions
是包含预发布版本和alpha版本beta版本这些,这些版本在排序上还是会高于稳定版;maxSatisfying
的返回会过滤掉这些版本只保留最近的稳定版本。
大部分情况下依赖的latest都应该指向stable版本,只有少量依赖不这么做。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -72,7 +73,7 @@ export class TaskRepository extends AbstractRepository { | |||
if (!model || !model.data.specificVersions) return; | |||
if (specificVersions) { | |||
const data = model.data; | |||
const combinedVersions = Array.from(new Set(data.specificVersions.concat(specificVersions))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Set 的用法有什么问题?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也没什么大问题,不过感觉lodash的函数语义更明确,可读性好一点,然后查了一下似乎性能也更好一点。所以就直接用lodash了
[skip ci] ## [3.48.4](v3.48.3...v3.48.4) (2023-11-28) ### Bug Fixes * incorrect latest tag in strict specific version ([#610](#610)) ([acfd667](acfd667))
@hezhengxu2018 邀请你加入 cnpm core team https://github.com/orgs/cnpm/teams/core/members |
[skip ci] ## [3.48.4](v3.48.3...v3.48.4) (2023-12-07) ### Bug Fixes * incorrect latest tag in strict specific version ([#610](#610)) ([acfd667](acfd667))