Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Prompt before applying `AUTO_PIN` to `package.json`

Aperta
#691 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia individuando l’implementazione di AUTO_PIN di Corepack e i test esistenti. Segui il percorso che aggiorna un package.json esistente quando COREPACK_ENABLE_AUTO_PIN è impostato su 1, quindi determina come dovrebbe comportarsi il prompt prima di tale aggiornamento. Il lavoro è completo quando l’utente può approvare o rifiutare la modifica di packageManager senza influire sugli scenari esistenti di npm e Yarn.

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

Descrizione

What would you like?

Corepack AUTO_PIN should prompt before adding a packageManager field to an existing package.json file. It may not be a desired change.

Why is this needed?

By default, and if the environment variable COREPACK_ENABLE_AUTO_PIN is not set to 0 If COREPACK_ENABLE_AUTO_PIN is set to 1, then Corepack adds a packageManager field to an existing package.json file if the field is not present.

Especially when working in a hybrid environment using package managers npm and Yarn in a mixture of projects, some of which are set up to work with Corepack and others are not, then some actions can lead to a packageManager field being added to an existing package.json file where this is not desired.

Consider the following scenario:

  • Project-npm is configured for npm without Corepack (no packageManager field)
  • Project-yarn-v1-corepack is configured for Yarn Classic with Corepack (packageManager field contains yarn@1.22.22+sha512...)

If my working directory cwd is in Project-npm and I execute yarn -v overlooking what project I am in, then my npm project becomes corrupted with the unwanted Yarn packageManager field. There is no prompt to allow me to recognize my mistake and prevent the package.json from being updated.

$ yarn -v
! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e.
! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager

Other

Lingua principale
TypeScript
Stelle
3.8k
Fork
279
Merge medio
1h 47m
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

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 nodejs/corepack

Tutte le issue di nodejs/corepack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.