pnpm update
별칭: up, upgrade
pnpm update는 지정된 범위에 따라 패키지를 최신 버전으로 업데이트합니다.
인수 없이 사용하면, 모든 의존성을 업데이트합니다.
요약#
| 명령어 | 의미 |
|---|---|
pnpm up |
package.json에 지정된 범위를 준수하여 모든 종속성을 업데이트합니다 |
pnpm up --latest |
모든 종속성을 최신 버전으로 업데이트합니다 |
pnpm up foo@2 |
foo를 v2의 최신 버전으로 업데이트합니다 |
pnpm up "@babel/*" |
@babel 스코프 아래의 모든 종속성을 업데이트합니다 |
Since v11.27.1, a dependency whose specifier comes from a packageExtensions entry, a readPackage hook, or an override is not written to package.json. The lockfile keeps that specifier. pnpm update and pnpm audit --fix=update still move it inside the range.
An exact pin from one of those sources is left as it is. When that pin is a vulnerable version, pnpm audit --fix=update warns and points at pnpm audit --fix, which writes an override. An override is applied after packageExtensions and readPackage, so it replaces a specifier those supply.
Updating to a specific version#
Since v11.23.0, pnpm update <name>@<version> fails with ERR_PNPM_UPDATE_VERSION_ON_INDIRECT_DEP when the package is not a direct dependency of any selected project. There is nowhere to record the version in that case; pin a transitive dependency through overrides instead. Ranges and tags are unaffected.
패턴으로 종속성 선택하기#
패턴을 사용하여 특정 의존성을 업데이트할 수 있습니다.
모든 babel 패키지를 업데이트합니다:
pnpm update "@babel/*"
webpack을 제외한 모든 종속성을 업데이트합니다:
pnpm update "\!webpack"
패턴은 조합할 수도 있으므로, 다음 명령은 core를 제외한 모든 babel 패키지를 업데이트합니다:
pnpm update "@babel/*" "\!@babel/core"
GitHub Actions 업데이트하기#
추가된 버전: v11.16.0
pnpm outdated는 저장소의 워크플로 파일에서 참조하는 GitHub Actions의 업데이트를 확인할 수 있으며, pnpm update는 이를 업데이트할 수 있습니다. 이 기능은 모든 명령에서 옵트인 방식입니다: --include-github-actions를 전달하거나, 기본적으로 활성화하려면 pnpm-workspace.yaml에서 update.githubActions를 true로 설정하세요.
업데이트된 액션은 정확한 커밋 해시로 고정되며, 릴리스 태그는 주석으로 보존됩니다:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Local actions are followed rather than looked up: a ./-relative reference, and
since v11.26.0 GitHub's self-repository spelling
(uses: $/.github/actions/setup), resolve inside the repository.
업데이트 확인은 참조된 모든 저장소에 대해 git ls-remote를 실행합니다. Actions whose refs cannot be read (for example, an action in a private repository) are skipped with a warning. 액션이 다른 GitHub 서버(예: GitHub Enterprise Server)에서 호스팅되는 경우 update.githubActionsServer(v11.17.0에서 추가됨)를 설정하세요.
옵션#
--recursive, -r#
package.json이 있는 모든 하위 디렉터리(node_modules 제외)에서 동시에 업데이트를 실행합니다.
사용 예:
pnpm --recursive update
# updates direct dependencies only
pnpm --recursive update --depth 0
# update typescript to the latest version in every package
pnpm --recursive update typescript@latest
--latest, -L#
package.json에 지정된 버전 범위가 latest 태그보다 낮은 경우에 한해, 종속성을 latest 태그로 결정되는 최신 안정 버전으로 업데이트합니다(메이저 버전을 넘어 업그레이드될 수 있음)(즉, 프리릴리스를 다운그레이드하지 않습니다).
Since v11.27.1, --latest does not move a dependency past a specifier supplied by packageExtensions, a readPackage hook, or an override. The lockfile stays inside that specifier.
--global, -g#
글로벌 패키지를 업데이트합니다. Packages from the pnpm 10 global layout are migrated to the current layout. After a successful migration, pnpm removes the old installation and its symlinks, shims, and hard-linked executables from PNPM_HOME.
--workspace#
워크스페이스에서 모든 패키지를 연결하려고 시도합니다. 워크스페이스 내 패키지의 버전과 일치하도록 버전이 업데이트됩니다.
특정 패키지가 업데이트된 경우 업데이트된
의존성이 워크스페이스 내에서 발견되지 않으면 명령이 실패합니다. 예를 들어, express가 워크스페이스 패키지가 아니면 다음 명령은 실패합니다:
pnpm up -r --workspace express
--prod, -P#
dependencies 및 optionalDependencies의 패키지만 업데이트합니다.
--dev, -D#
devDependencies의 패키지만 업데이트합니다.
--no-optional#
optionalDependencies의 패키지는 업데이트하지 않습니다.
--peer#
Added in: v11.28.0
Also update the ranges in peerDependencies. Without this flag, pnpm update leaves peerDependencies unchanged.
pnpm update --peer react
--interactive, -i#
오래된 의존성을 표시하고 업데이트할 의존성을 선택합니다.
--global과 함께 사용하면 v11.21.0부터 각 격리된 설치 그룹이 하나의 선택 가능한 항목으로 표시됩니다: 전역 설치를 공유하는 패키지는 하나의 단위로 함께 업데이트됩니다.
--no-save#
package.json의 범위를 업데이트하지 않습니다.
--changeset#
추가된 버전: v11.16.0
After the update completes, write a change intent (a changesets-compatible .changeset/*.md file) declaring a patch bump for every workspace package whose dependencies or optionalDependencies were changed by the update, and a major bump when its peerDependencies changed. catalog: 프로토콜을 통해 업데이트된 카탈로그 항목을 사용하는 패키지도 포함됩니다. 비공개 패키지, 이름이 없는 패키지, .changeset/config.json의 ignore 배열에 나열된 패키지는 건너뜁니다. .changeset/config.json이 없으면 경고가 출력되고 changeset이 생성되지 않습니다.
이 동작을 기본적으로 활성화하려면 pnpm-workspace.yaml에서 update.changeset을 true로 설정하고, 한 번의 업데이트에 대해 설정을 재정의하려면 --no-changeset을 사용하세요.
--include-github-actions#
추가된 버전: v11.16.0
저장소의 워크플로 파일에서 참조하는 GitHub Actions도 업데이트합니다. GitHub Actions 업데이트를 참고하세요.
Supply-chain policy flags#
Added in: v11.26.0
pnpm update accepts the same policy overrides as pnpm install and pnpm add: --trust-lockfile, --no-trust-lockfile, --trust-policy, --trust-policy-exclude, and --trust-policy-ignore-after, so a policy can be relaxed or tightened for a single run without editing pnpm-workspace.yaml.