[RRFC] Allow suppressing workspace allowScripts warnings for intentional standalone workspace packages
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 38/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript
- Ambito
- cli
Direzione di ricerca
Esamina il comportamento degli avvisi introdotto da npm/cli#9360 e la policy allowScripts in npm/rfcs#868. Riproduci la configurazione del workspace descritta nell’issue, quindi definisci una proposta di configurazione con ambito strettamente limitato che mantenga l’avviso per impostazione predefinita e sopprima solo questo avviso del workspace quando viene abilitata esplicitamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature Request: Allow suppressing workspace allowScripts warnings for intentional standalone workspace packages
Current Behavior
In an npm workspace, npm warns when a non-root workspace package has a top-level allowScripts field:
npm warn allow-scripts allowScripts in workspace project (/path/to/repo/apps/project) is ignored. Move the field to the project root package.json.
This warning is technically correct for a root workspace install, but it is not always actionable.
In our monorepo, some workspaces are Git submodules and can also be installed, developed, or released as standalone projects. Their package.json files intentionally contain their own allowScripts policy for standalone usage. When those same projects are checked out inside the parent monorepo, npm treats them as workspaces and warns on every root install.
Moving the field to the parent root is not a valid fix because the submodule must remain self-contained.
Expected Behavior
npm should provide a targeted way to suppress this warning when a workspace package intentionally keeps allowScripts for standalone use.
For example, one of:
warn-workspace-allow-scripts=false
or:
allow-scripts-warn-workspaces=false
or another narrowly scoped config name.
This should suppress only the non-root workspace allowScripts warning, without requiring loglevel=error and without hiding unrelated npm warnings.
Why This Matters
loglevel=error is currently the only practical workaround, but it suppresses too much. In CI and local development, teams still want to see peer dependency warnings, deprecations, audit warnings, and other useful npm warnings.
The current warning becomes noisy in monorepos that include standalone packages or Git submodules as workspaces. In that setup, the warning is expected and non-actionable, because the package-local policy is needed outside the parent workspace context.
Steps To Reproduce
- Create a root workspace package:
{
"private": true,
"workspaces": ["packages/*"]
}
- Create
packages/example/package.json:
{
"name": "example",
"version": "1.0.0",
"allowScripts": {
"[email protected]": true
}
}
- Run:
npm install
- Observe:
npm warn allow-scripts allowScripts in workspace example (.../packages/example) is ignored. Move the field to the project root package.json.
Proposed Solution
Add a narrowly scoped npm config that disables this specific warning.
Default should remain the current behavior, so users still get warned unless they explicitly opt out.
References
This warning appears to have been introduced as part of npm/cli#9360, which implemented Phase 1 of the allowScripts install-script policy from npm/rfcs#868.
https://github.com/npm/cli/pull/9360
https://github.com/npm/rfcs/pull/868
- Lingua principale
- JavaScript
- Stelle
- 780
- Fork
- 266
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di npm/rfcs
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Issue simili
-
docs: add SECURITY.md vulnerability reporting policyForse già presa @AK-Lmn l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
flisk-sh/linux2wasm#12 ·
I maintainer di solito rispondono entro 1 giorno
-
possible bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Mintplex-Labs/anything-llm#7388 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 60/100
I maintainer di solito rispondono entro 1 giorno
-
v6: Minified bootstrap.min.css is missing header infoForse già presa @lazerg l’ha presa oggi. Apertabug build confirmed has-pr v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
[workshop-sync] workshop/side-quest-26-01-forecast-costs.md: forecast default history window is inaccurateForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
githubnext/gh-aw-workshop#6332 ·
I maintainer di solito rispondono entro 1 giorno