ITADN

--maturity-period ignored for `latest` and `next` modes

#262ClosedJerc92 创建于 2026-04-30
J
Jerc92commented
## Bug `--maturity-period N` does not filter out versions younger than N days when `mode === "latest"` (or `next`). It correctly filters for `default`, `major`, `minor`, `patch`, and `newest` modes. ## Repro ```bash # Package with a version released < 7 days ago taze latest --maturity-period 7 --include eslint-plugin-storybook ``` Output (today 2026-04-30, eslint-plugin-storybook 10.3.6 released 2026-04-29 = 1 day old): ``` eslint-plugin-storybook ~2mo ^10.2.17 → ^10.3.6 ~1d ``` Expected: 10.3.6 filtered out, fallback to 10.3.5 (released 2026-04-07 = ~3 weeks old). ## Root cause `getMaxSatisfying()` in `src/utils/versions.ts` (or compiled `dist/types-*.mjs:4260` in v19.11.0) returns `tags.latest` directly for `mode === "latest"` — ignores the `versions` array which is the maturity-period-filtered list. ```ts function getMaxSatisfying(versions, current, mode, tags) { let version = null; if (mode === "latest") version = tags.latest; // <-- skips filteredVersions else if (mode === "newest") version = versions.at(-1); else if (mode === "next") version = tags.next; // <-- same bug else { /* iterates `versions` which IS the filtered list */ } } ``` `getVersionOfRange()` correctly applies `filterVersionsByMaturityPeriod()` and passes the filtered list to `getMaxSatisfying`, but the `latest`/`next` branches discard it. ## Suggested fix For `latest` / `next`, verify the dist-tag version is in `versions` (the filtered list). If not, fall back to `getMaxSatisfying(versions, current, "newest", tags)` or pick the highest matching version from the filtered list. ```ts if (mode === "latest") { version = versions.includes(tags.latest) ? tags.latest : null } ``` ## Version - taze: 19.11.0 - node: 25.9.0 - platform: darwin-arm64
关闭于 2026-05-15 0 条评论