W3cubDocs

/Yarn

yarn upgrade

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.
[...]
├─ [email protected]
│  ├─ [email protected]
│  └─ [email protected]
├─ [email protected]
│  └─ [email protected]
[...]
└─ [email protected]
✨  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
└─ [email protected]
✨  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 [email protected]
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
└─ [email protected]
✨  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
└─ [email protected]
✨  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
└─ [email protected]
✨  Done in 6.10s.

This will update your package.json to look like this:

-  "d3-scale": "^0.9.3",
+  "d3-scale": "^1.0.3",

© 2016–2017 Yarn Contributors
Licensed under the BSD License.
https://yarnpkg.com/en/docs/cli/upgrade