(rootInfo: CheckResult)
| 4 | import { log } from './utils'; |
| 5 | |
| 6 | export function resolveCheckResult(rootInfo: CheckResult): CheckResult { |
| 7 | const { expVersion, ...rootResult } = rootInfo; |
| 8 | const rollout = expVersion?.config?.rollout?.[packageVersion]; |
| 9 | if (rootResult.update && expVersion && typeof rollout === 'number') { |
| 10 | if (isInRollout(rollout)) { |
| 11 | log(`${expVersion.name} in ${rollout}% rollout, continue`); |
| 12 | if (expVersion.hash === currentVersion) { |
| 13 | return { upToDate: true }; |
| 14 | } |
| 15 | const info: CheckResult = { |
| 16 | update: true, |
| 17 | ...expVersion, |
| 18 | }; |
| 19 | if (rootResult.paths) { |
| 20 | info.paths = rootResult.paths; |
| 21 | } |
| 22 | return info; |
| 23 | } |
| 24 | log(`${expVersion.name} not in ${rollout}% rollout, ignored`); |
| 25 | } |
| 26 | if (rootResult.update && rootResult.hash === currentVersion) { |
| 27 | return { upToDate: true }; |
| 28 | } |
| 29 | return rootResult; |
| 30 | } |
no test coverage detected