Upgrades packages to their latest version based on the specified range.
yarn upgrade
This command updates all dependencies to their latest version based on the
version range specified in the package.json
file. The yarn.lock
file will
be recreated as well.
yarn upgrade
yarn upgrade vx.x.x
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 867 new dependencies.
[...]
ββ jest-cli@16.0.1
β ββ yargs-parser@3.2.0
β ββ yargs@5.0.0
ββ jest-diff@16.0.0
β ββ diff@3.0.1
[...]
ββ yargs@4.8.1
β¨ Done in 20.79s.
yarn upgrade [package]
This upgrades a single named package to the version specified by the latest
tag (potentially upgrading the package across major versions).
yarn upgrade d3-scale
yarn upgrade vx.x.x
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
ββ d3-scale@1.0.3
β¨ Done in 6.10s.
This will update your package.json
to look like this:
- "d3-scale": "^0.9.3",
+ "d3-scale": "^1.0.3",
yarn upgrade [package@version]
This will upgrade (or downgrade) an installed package to the specified version. You can use any SemVer version number or range.
yarn upgrade d3-scale@1.0.2
yarn upgrade vx.x.x
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
ββ d3-scale@1.0.2
β¨ Done in 6.43s.
This will update your package.json
to look like this:
- "d3-scale": "^1.0.3",
+ "d3-scale": "^1.0.2",
yarn upgrade [package@tag]
This will upgrade a package to the version identified by tag
.
Tag names are chosen by project
maintainers, typically you use this command to install an experimental or long
term support release of an actively developed package. The tag you choose will
be the version that appears in your package.json
file.
yarn upgrade react@next
yarn upgrade v0.16.0
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
ββ react@15.4.0-rc.4
β¨ Done in 3.73s.
This will update your package.json
to look like:
- "react": "^15.3.2",
+ "react": "next",
Similarly, using the latest
tag will result in an updated package.json
that
looks like:
- "react": "^15.3.2",
+ "react": "latest",
yarn upgrade [package] --ignore-engines
This upgrades a single named package to the version specified by the latest
tag ignoring engines check.
yarn upgrade d3-scale --ignore-engines
yarn upgrade vx.x.x
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
ββ d3-scale@1.0.3
β¨ Done in 6.10s.
This will update your package.json
to look like this:
- "d3-scale": "^0.9.3",
+ "d3-scale": "^1.0.3",
← Previous: yarn unlink Next: yarn version →
When you want to use another package, you first need to add it to your dependencies. Running `yarn add` installs it into your project.
Tags are a way of publishing versions of your package with a label. Users of your package can install that instead of a version number.
Packages in Yarn follow Semantic Versioning, also known as βsemverβ. When you install a new package it will be added with a semver version range.