Langsung ke konten utama
Versi: 9.x

pnpm update

Aliases: up, upgrade

pnpm update updates packages to their latest version based on the specified range.

Ketika digunakan tanpa argumen, perintah ini akan memperbarui semua dependensi.

RINGKASAN

PerintahArti
pnpm upUpdates all dependencies, adhering to ranges specified in package.json
pnpm up --latestUpdates all dependencies to their latest versions
pnpm up foo@2Updates foo to the latest version on v2
pnpm up "@babel/*"Updates all dependencies under the @babel scope

Selecting dependencies with patterns

You can use patterns to update specific dependencies.

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"

Pengaturan

--recursive, -r

Concurrently runs update in all subdirectories with a package.json (excluding node_modules).

Contoh penggunaan:

pnpm --recursive update
# memperbarui semua paket sampai kedalaman 100 subdirektori
pnpm --recursive update --depth 100
# memperbarui typescript ke versi paling mutakhir di setiap paket
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

Memperbarui paket-paket global.

--workspace

Mencoba menautkan semua paket dari workspace. Versi akan diperbarui mengikuti versi paket yang ditentukan di dalam workspace.

Jika paket yang tentukan mendapatkan pembaruan, perintah akan gagal jika salah satu pembaruan dependensi tidak ditemukan di dalam workspace. For instance, the following command fails if express is not a workspace package:

pnpm up -r --workspace express

--prod, -P

Only update packages in dependencies and optionalDependencies.

--dev, -D

Only update packages in devDependencies.

--no-optional

Don't update packages in optionalDependencies.

--interactive, -i

Show outdated dependencies and select which ones to update.

--filter <package_selector>

Read more about filtering.