본문으로 건너뛰기
버전: 10.x

pnpm publish

레지스트리에 패키지를 게시합니다.

pnpm [-r] publish [<tarball|folder>] [--tag <tag>]
[--access <public|restricted>] [options]

When publishing a package inside a workspace, the LICENSE file from the root of the workspace is packed with the package (unless the package has a license of its own).

You may override some fields before publish, using the publishConfig field in package.json. You also can use the publishConfig.directory to customize the published subdirectory (usually using third party build tools).

When running this command recursively (pnpm -r publish), pnpm will publish all the packages that have versions not yet published to the registry.

옵션​

--recursive, -r​

Publish all packages from the workspace.

--json​

Show information in JSON format.

--tag <tag>​

지정된 태그가 있는 패키지를 게시합니다. By default, pnpm publish updates the latest tag.

예시:

# foo 패키지 디렉토리 내부
pnpm publish --tag next
# foo의 다음 버전을 사용하려는 프로젝트에서
pnpm add foo@next

--access <public|restricted>​

게시된 패키지가 공개 또는 제한되어야 하는지 여부를 레지스트리에 알려줍니다.

--no-git-checks​

Don't check if current branch is your publish branch, clean, and up-to-date with remote.

--publish-branch <branch>​

  • Default: master and main
  • Types: String

최신 변경 사항을 게시하는 데 사용되는 저장소의 기본 브랜치입니다.

--force​

현재 버전이 이미 레지스트리에 있는 경우에도 패키지를 게시하려고 합니다.

--report-summary​

Save the list of published packages to 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​

실제로 레지스트리에 게시하는 것을 제외하고 게시가 수행하는 모든 작업을 수행합니다.

--otp​

이중 인증이 필요한 패키지를 게시할 때, 이 옵션은 일회용 암호를 지정할 수 있습니다.

--provenance​

When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from.

--filter <package_selector>​

Read more about filtering.

환경설정​

You can also set gitChecks, publishBranch options in the pnpm-workspace.yaml file.

예시:

pnpm-workspace.yaml
gitChecks: false
publishBranch: production

라이프사이클 스크립트​

  • prepublishOnly
  • prepublish
  • prepack
  • prepare
  • postpack
  • publish
  • postpublish