chore: remove yargs override in root package.json once all sub-packages are updated

Aperta
#9,130 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
nodejs, typescript

Direzione di ricerca

Inizia dal package.json nella radice e ispeziona le dichiarazioni dei pacchetti del repository per individuare dipendenze da versioni precedenti di yargs. Aggiorna i sottopacchetti o gli strumenti interessati, quindi rimuovi la voce yargs da pnpm.overrides. Verifica che l’installazione e le esecuzioni dei test CI su Node.js 24+ completino senza gli errori di compatibilità descritti nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Background

In Node.js >= 24, certain older versions of yargs (used transitively across packages in the monorepo) cause runtime failures related to ES module scope and require resolution. To temporarily prevent ESM-scope/require-compat crashes in Node 24+ environments during CI test runs and installations, we introduced a hook in .pnpmfile.cjs (via #8460) that dynamically mutates any direct or indirect dependency on yargs to version 18.0.0 when the Node.js version is >= 24.

Why this was needed
  • Some of our older package dependencies/tools pulled in outdated versions of yargs (such as yargs@16 or yargs@17).
  • Node.js >= 24 implements stricter constraints and changed behaviors regarding ESM resolution and require(esm) integration, triggering loader/scope compatibility failures with these older yargs releases.
  • Setting a global pnpm-file override was a safe, non-intrusive stopgap to stabilize the CI pipeline on newer Node.js versions without requiring a simultaneous, repo-wide upgrade of all individual packages.
Impact of the PNPM Workspace PR (https://github.com/googleapis/google-cloud-node/pull/8973)

In our upcoming transition to a PNPM workspace (currently in progress in PR #8973):

  • The programmatic .pnpmfile.cjs is deleted entirely.
  • Instead of using a custom JS script to mutate dependencies during installation, the monorepo leverages PNPM's native, declarative overrides feature in the root package.json ("pnpm": { "overrides": { "yargs": "^17.7.2" } }).
  • This means that once the PNPM workspace PR is merged, the code reviewer's commented line in .pnpmfile.cjs will be automatically cleaned up.
  • However, the global override mechanism itself will still exist in the root package.json "pnpm.overrides" field.
When & How to Fix

To completely remove the global override from the root package.json:

  1. Identify all packages/tools in the repository that still depend on versions of yargs older than 17.7.2 / 18.0.0.
  2. Upgrade yargs to a consistent, modern version (e.g. ^18.0.0 or newer) across all sub-projects and tools.
  3. Remove the "yargs" entry from "pnpm.overrides" in the root package.json.
Lingua principale
TypeScript
Stelle
3.2k
Fork
732
Merge medio
2g 11h
PR unite (30g)
99

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di googleapis/google-cloud-node

Tutte le issue di googleapis/google-cloud-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.