pnpm publish
npm レジストリにパッケージを公開します。
pnpm [-r] publish [<tarball|folder>] [--tag <tag>]
[--access <public|restricted>] [options]
ワークスペース内のパッケージを公開するとき、パッケージ自体にライセンスファイルが存在しなければ、ワークスペースの最上位に配置されたLICENSEファイルを同梱します。
package.json
のpublishConfigフィールドを使用して、公開するパッケージに含まれるいくつかのフィールドを上書きできます。 publishConfig.directory
で、公開するサブディレクトリを指定できます (サードパーティのビルドツールと共に使用する場合が多い) 。
このコマンドを再帰的に実行すると (pnpm -r publish
)、 pnpm はレジストリに公開したバージョンの存在しない全てのパッケージを公開します。
引数
--recursive, -r
Publish all packages from the workspace.
--json
JSON 形式で情報を表示します。
--tag <tag>
Publishes the package with the given tag. By default, pnpm publish
updates the latest
tag.
For example:
# inside the foo package directory
pnpm publish --tag next
# in a project where you want to use the next version of foo
pnpm add foo@next
--access <public|restricted>
Tells the registry whether the published package should be public or restricted.
--no-git-checks
Don't check if current branch is your publish branch, clean, and up-to-date with remote.
--publish-branch
- デフォルト: master と main
- タイプ:文字列
最新の変更を公開するために使用する、リポジトリの基本ブランチ名を指定します。
--force
現在のバージョンがすでにレジストリに公開済みでも、パッケージの公開を試みます。
--report-summary
公開済みパッケージのリストを pnpm-publish-summary.json
に保存します。 なんらかの仕組みで公開済みパッケージの一覧を報告するときに便利です。
An example of a pnpm-publish-summary.json
file:
{
"publishedPackages": [
{
"name": "foo",
"version": "1.0.0"
},
{
"name": "bar",
"version": "2.0.0"
}
}
]
--dry-run
Does everything a publish would do except actually publishing to the registry.
--otp
When publishing packages that require two-factor authentication, this option can specify a one-time password.
--filter <package_selector>
詳細についてはフィルタリングに関するドキュメントを参照してください。
設定
You can also set git-checks
, publish-branch
options in the .npmrc
file.
For example:
git-checks=false
publish-branch=production
Life Cycle Scripts
prepublishOnly
prepublish
prepack
prepare
postpack
publish
postpublish