r/reactjs • u/tyteen4a03 • May 12 '26
Resource PSA: How to set minimum release age for your package manager (they all do it differently)
https://lemmy.zip/post/64164854
39
Upvotes
r/reactjs • u/tyteen4a03 • May 12 '26
12
u/tyteen4a03 May 12 '26 edited May 12 '26
I can't submit text posts here. So here's the text post in, well, text post form:
Because there's no guide on how each package manager sets their minimumReleaseAge and every package manager uses a different format... (can we please get a standards committee going for security-related configs like these?)
Note: unless otherwise specified, X is a number ONLY. No date units (don't specify
7dor1440m. Your config will error.)And for the love of your favourite deity, remove all carets (
^from yourpackage.jsonunless you know what you are doing. Always pin to exact versions (there should be no special characters in front of your version number).npmrc,min-release-age=X. X is the number of days. Requires npmv11.10.0or above.pnpm-workspace.yaml, setminimumReleaseAge: X. X is the number of minutes. Requires pnpmv10.16.0or above. From v11 onwards, the default is1440minutes (1 day).yarnrc.yml, setnpmMinimalAgeGate: X. X is a duration (date units supported arems, s, m, h, d, w, e.g.7d). If no duration is specified, then it is parsed as minutes (i.e.npmMinimalAgeGate: 1440is equal tonpmMinimalAgeGate: 1440m). Requires Yarnv4.11or above (Yarnv4.10also has the option, but only supported minutes as a raw number)deno.json, set"minimumDependencyAge": "X". X can be a number in minutes, a ISO-8601 Duration or a RFC3339 absolute timestamp (basically anything that looks like a date; if you are in Freedom Country remember to swap the month and the date). Requires Denov2.6.0or above.Bun: In
bunfig.toml, set:X is the number of seconds. Requires Bun
v1.3.0or above.5
u/beth_maloney May 12 '26
What's everyone selecting as the minimum age?
2
u/TwiNighty May 12 '26
Slight correction: Yarn 4.10.0 supports the
npmMinimalAgeGateconfig but only as a number of minutes. The duration string option was added in 4.11.01
u/TheScapeQuest May 12 '26
This is all well and good for installing things locally, but a lot of dependency upgrades are handled automatically these days (e.g. dependabot). While these tools have mechanisms to prevent recent direct dependencies from being installed (
cooldownwith dependabot), they do nothing for transitive dependencies.