[DOCS] Explain registry reads and registry selection for npm publish --dry-run

Abierto Apto para principiantes
#10,386 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
85/100
Tipo de issue
Documentación
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, node.js

Línea de trabajo

Empieza por la referencia de npm v12 a publish enlazada en el issue y comprueba cómo describe --dry-run, la selección del registry y el comportamiento sin conexión. Documenta que la validación de dry-run puede leer las versiones de los paquetes, explica la precedencia del registry descrita en el issue e incluye el ejemplo del tarball local. El trabajo estará terminado cuando la referencia explique la consulta de versiones, la selección del registry y qué no puede verificar el modo sin conexión.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Is there an existing issue for this?
  • I have searched the existing issues
This is a CLI Docs Enhancement, not another kind of Docs Enhancement.
  • This is a CLI Docs Enhancement.
Description of Problem

The publish reference could explain that --dry-run skips the publish write while still allowing registry reads and version checks.
The same tarball can pass or fail based on which versions a registry reports.
Someone using a dry run to check a package before publishing can't tell from the docs which registry it will ask.

We reproduced this with npm 12.2.3 and Node.js 26.13.1 using loopback registries.
Set the package name and version to [email protected].
Set publishConfig.registry and npm_config_registry to different registries.
Use an isolated empty cache for each run and set npm_config_update_notifier=false to measure requests from publish itself.

npm pack --ignore-scripts
npm publish ./example-dry-run-0.0.0.tgz --dry-run --ignore-scripts

The dry run sent GET /example-dry-run to the registry in publishConfig and made no upload request.
Returning {"versions":{}} let it pass.
Returning {"versions":{"1.0.0":{"name":"example-dry-run","version":"1.0.0"}}} made it fail with “Cannot implicitly apply the "latest" tag.”
An explicit --registry pointed the version lookup at that registry.
With an empty cache, --offline stopped the package lookup.
With the notifier enabled outside CI, npm still requested /npm from the registry set in the environment.

Potential Solution

Document the version lookup and the registry order for this unscoped package.
An explicit --registry wins over publishConfig.registry, which wins over npm_config_registry.
Give a local-tarball example with --offline --no-update-notifier and explain that an offline run cannot confirm versions on the remote registry.
The maintainers confirmed that dry-run validation is intentional in the npm 11 version-check report.

Docs URL

https://docs.npmjs.com/cli/v12/commands/npm-publish/

I'm happy to open a pull request with the documentation and a focused loopback-registry test if that would help.


Posted by Claude Opus 5.5 on behalf of @boblangley after review

Lenguaje dominante
JavaScript
Estrellas
10.3k
Forks
5k
Merge medio
4 d 11 h
PR fusionados (30 d)
26

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de npm/cli

Todos los issues de npm/cli

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.