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

オープン 初心者向け
#10,386 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, node.js
領域
cli, documentation

調査の方向性

issue にリンクされている npm v12 の publish リファレンスから始め、--dry-run、registry の選択、オフライン時の動作がどのように説明されているかを確認してください。dry-run の検証でパッケージのバージョンを読み取れることを記載し、issue で説明されている registry の優先順位を説明して、ローカル tarball の例を含めてください。リファレンスがバージョンの参照、registry の選択、オフラインモードで検証できない内容を説明していれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
JavaScript
スター
10.3k
フォーク
5k
平均マージ
4日 11時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

npm/cli のほかの issue

npm/cli の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。