Skip to content

Add npm release cooldown (.npmrc: min-release-age=7) - #219

Merged
muodov merged 2 commits into
mainfrom
jmatthews/npm-cooldown-7-days
Nov 19, 2026
Merged

muodov merged 2 commits into
mainfrom
jmatthews/npm-cooldown-7-days

Conversation

@jeannamatthews

@jeannamatthews jeannamatthews commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds an .npmrc that turns on npm's release cooldown and two related settings:

min-release-age=7
save-exact=true
package-lock=true
  • min-release-age=7: npm only installs versions published at least 7 days ago, so a compromised release is usually caught and pulled before it reaches us. Needs npm >= 11.10; .nvmrc is 24.20.0, which bundles npm 11.19.0.
  • save-exact=true: npm install <pkg> records an exact version instead of a ^ range. Existing entries in package.json are unchanged.
  • package-lock=true: npm's default, made explicit so a user or CI setting can't turn the lockfile off.

Steps to test

A .npmrc line can be silently ignored (npm below 11.10, an environment override), so the real test is asking npm for a too-new version and checking it refuses. Run either option from the repo root on this branch:

  1. A single npm pack --dry-run command. Pick a version of a frequently released package published 5 to 7 days ago (e.g. a recent electron-to-chromium, which releases several times a week; caniuse-lite sometimes goes more than a week without one) and run:

    npm pack --dry-run electron-to-chromium@<version>

    Expect npm error code ETARGET ... with a date before <date>. If it prints npm notice filename: ..., the cooldown isn't working. It downloads nothing and changes no files.

  2. If you prefer a script: canary.sh from our internal node-upgrade repo (cooldown/ directory) runs the same check and picks the version for you:

    bash <node-upgrade>/cooldown/canary.sh . 7 electron-to-chromium

    Expect PASS: cooldown in force, ~7.00 days >= 7.

Please test this wherever this repo gets installed — you know that best (CI, Docker builds, VMs, developer laptops…). At a minimum, run one of the checks in CI, e.g. a temporary step after npm ci in .github/workflows/node.js.yml on a throwaway draft PR you close afterwards.

I tested locally with Node 24.20.0 / npm 11.19.0, using this branch's package.json, package-lock.json and .npmrc: npm ci succeeds (including the git dependency @duckduckgo/eslint-config) and leaves the lockfile unchanged, and canary.sh passes. I also ran npm ci on npm 11.11.0 (Node 24.14.1), the one npm where the cooldown plus a git dependency can break npm ci; it passes here too.

When you've tested, please share your results (where you tested, and what npm printed) on the internal Asana task for this change, which is assigned to you.

After reviewing/testing, I'd love for you to merge this change.

Impact and risks

  • npm ci and versions already in package-lock.json are unaffected.
  • The git dependency @duckduckgo/eslint-config installs as before. The cooldown doesn't apply to git dependencies, so this change doesn't protect them.
  • Adding or upgrading a package picks only versions at least 7 days old; an exact pin to anything newer fails with ETARGET. To bypass it once: npm install <pkg>@<version> --min-release-age=0.
  • tracker-radar-internal's Jenkins jobs clone this repo and run npm ci in it (on npm 11.19.0), so the cooldown applies there too; installs from the lockfile are unaffected. This PR adds no engine-strict, so it can't fail an older npm.
  • To undo, delete .npmrc.

🤖 Generated with Claude Code

npm only installs versions published at least 7 days ago; save-exact and
package-lock make exact saves and the lockfile explicit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@jeannamatthews

Copy link
Copy Markdown
Contributor Author

If this looks good to you @muodov , could you merge?

@muodov
muodov merged commit fa45ed0 into main Nov 19, 2026
2 of 3 checks passed
@muodov
muodov deleted the jmatthews/npm-cooldown-7-days branch November 19, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants