pnpm update
Aliases: up, upgrade
pnpm update 는 지정된 범위를 기반으로 패키지를 최신 버전으로 업데이트합니다.
인수 없이 사용하면, 모든 의존성을 업데이트합니다.
요약#
| 명령어 | 의미 |
|---|---|
pnpm up | package.json에 지정된 범위를 준수하여, 모든 의존성을 업데이트합니다. |
pnpm up --latest | Updates all dependencies to their latest versions |
pnpm up foo@2 | foo 를 v2의 최신 버전으로 업데이트합니다. |
pnpm up "@babel/*" | @babel 범위 아래의 모든 의존성을 업데이트합니다. |
What an update writes#
Besides moving pnpm-lock.yaml to the newly resolved versions, pnpm update writes the new range back to the place the dependency is declared:
- In
package.json, the range is moved onto the resolved version while the operator the dependency already declared is kept, so^1.1.0stays a caret range. - A dependency declared through the
catalog:protocol is not rewritten inpackage.json. The catalog entry it points at is updated instead, inpnpm-workspace.yaml. - A dependency declared through a dist-tag, such as
"foo": "latest", keeps tracking the tag. The tag stays inpackage.jsonand only the lockfile moves to the version behind it — with--latestas well.
Pass --no-save to update the lockfile only and leave the declared ranges alone.
Selecting dependencies with patterns#
패턴을 사용하여 특정 의존성을 업데이트할 수 있습니다.
Update all babel packages:
pnpm update "@babel/*"
Update all dependencies, except webpack:
pnpm update "\!webpack"
Patterns may also be combined, so the next command will update all babel packages, except core:
pnpm update "@babel/*" "\!@babel/core"
Updating GitHub Actions#
Added in: v11.16.0
pnpm outdated can check the GitHub Actions referenced by the repository's workflow files for updates, and pnpm update can update them. This is opt-in for every command: pass --include-github-actions, or set update.githubActions to true in pnpm-workspace.yaml to enable it by default.
Updated actions are pinned to exact commit hashes, with their release tags preserved in comments:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Checking for updates runs git ls-remote against every referenced repository. Actions whose refs cannot be read — for example, an action in a private repository — are skipped with a warning. If the actions are hosted on a different GitHub server (such as a GitHub Enterprise Server), set update.githubActionsServer (added in v11.17.0).
옵션#
--recursive, -r#
package.json 이 있는 모든 하위 디렉토리에서 업데이트를 동시에 실행합니다 ( node_modules 제외).
사용 예:
pnpm --recursive update
# 최대 100개의 하위 디렉토리까지 모든 패키지를 업데이트합니다.
pnpm --recursive update --depth 100
# 모든 패키지의 타입스크립트를 최신 버전으로 업데이트합니다.
pnpm --recursive update typescript@latest
--latest, -L#
Update the dependencies to their latest stable version as determined by their latest tags (potentially upgrading the packages across major versions) as long as the version range specified in package.json is lower than the latest tag (i.e. it will not downgrade prereleases).
--global, -g#
글로벌 패키지를 업데이트합니다.
--workspace#
워크스페이스에서 모든 패키지를 연결하려고 시도합니다. 워크스페이스 내 패키지의 버전과 일치하도록 버전이 업데이트됩니다.
특정 패키지가 업데이트된 경우 업데이트된 의존성이 워크스페이스 내에서 발견되지 않으면 명령이 실패합니다. 예를 들어 다음 명령은 express 가 워크스페이스 패키지가 아닌 경우 실패합니다.
pnpm up -r --workspace express
--prod, -P#
dependencies 및 optionalDependencies의 패키지만 업데이트합니다.
--dev, -D#
devDependencies의 패키지만 업데이트합니다.
--no-optional#
optionalDependencies 의 패키지를 업데이트하지 않습니다.
--interactive, -i#
오래된 의존성을 표시하고 업데이트할 의존성을 선택합니다.
Since v11.21.0, combined with --global, each isolated install group is presented as one selectable item: packages that share a global installation update together as a unit.
--no-save#
Don't update the ranges in package.json.
--changeset#
Added in: 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. Packages that consume an updated catalog entry via the catalog: protocol are included. Private packages, packages without a name, and packages listed in the ignore array of .changeset/config.json are skipped. If .changeset/config.json does not exist, a warning is printed and no changeset is generated.
Set update.changeset to true in pnpm-workspace.yaml to enable this behavior by default, and use --no-changeset to override the setting for one update.
--include-github-actions#
Added in: v11.16.0
Also update the GitHub Actions referenced by the repository's workflow files. See Updating GitHub Actions.