All Articles

How to upgrade all yarn packages

Situation

Start a new project from some boilerplates. You need to upgrade all yarn packages to up-to-date state.

Manual

Check current outdated packages with yarn outdated command:

$ yarn outdated
Package                    Current  Wanted  Latest  Location
autoprefixer                 9.1.5   9.1.5   9.4.4   a-tool-name
eslint                       5.6.1  5.12.0  5.12.0  a-tool-name
eslint-plugin-jsx-a11y       6.1.1   6.1.2   6.1.2  a-tool-name
eslint-plugin-react         7.11.1  7.12.3  7.12.3  a-tool-name
express                     4.16.3  4.16.4  4.16.4  a-tool-name
next                         7.0.1   7.0.2   7.0.2  a-tool-name
node-sass                    4.9.3  4.11.0  4.11.0  a-tool-name
nodemon                     1.18.4  1.18.9  1.18.9  a-tool-name
normalize.css                8.0.0   8.0.1   8.0.1  a-tool-name
pm2                          3.2.2   3.2.7   3.2.7  a-tool-name
raw-loader                   0.5.1   0.5.1   1.0.0  a-tool-name
react                       16.5.2  16.7.0  16.7.0  a-tool-name
react-dom                   16.5.2  16.7.0  16.7.0  a-tool-name
react-icons                  3.1.0   3.3.0   3.3.0  a-tool-name
sweetalert2                 7.28.4  7.33.1  7.33.1  a-tool-name
winston-daily-rotate-file    3.3.3   3.5.2   3.5.2  a-tool-name

Upgrade packages manually to latest version:

$ yarn add autoprefixer@latest
$ yarn add raw-loader@latest
....

Check again outdated package:

$ yarn outdated

At this point, nothing should be output. Your package.json should be up-to-date