1 | # yarn-upgrade-all
|
2 |
|
3 | This is a command line utility program to upgrade all the packages in your `package.json` to the latest version
|
4 | (potentially upgrading packages across major versions).
|
5 |
|
6 |
|
7 | ## Installation
|
8 |
|
9 | ```
|
10 | yarn global add yarn-upgrade-all
|
11 | ```
|
12 |
|
13 | #### Installation locally
|
14 |
|
15 | ```
|
16 | yarn add yarn-upgrade-all
|
17 | ```
|
18 |
|
19 | Usage: `./node_modules/.bin/yarn-upgrade-all`
|
20 |
|
21 | #### Installation on Windows
|
22 |
|
23 | ```
|
24 | npm install -g yarn-upgrade-all
|
25 | ```
|
26 |
|
27 | :exclamation: Don't use `yarn` to install it on Windows because there is a bug: [yarnpkg/yarn#2224](https://github.com/yarnpkg/yarn/issues/2224).
|
28 |
|
29 |
|
30 | ## Usage
|
31 |
|
32 | ```
|
33 | cd <your-node-js-project>
|
34 | yarn-upgrade-all
|
35 | ```
|
36 |
|
37 | Or upgrade global packages:
|
38 |
|
39 | ```
|
40 | yarn-upgrade-all --global
|
41 | ```
|
42 |
|
43 |
|
44 | ## How does it work?
|
45 |
|
46 | For every package in `package.json`, run `yarn remove <package-name> && yarn add [--dev|--peer] <package-name>`.
|
47 |
|
48 |
|
49 | ## Why not simply `yarn upgrade --latest` ?
|
50 |
|
51 | Most of the time `yarn upgrade --latest` works. But I did meet some cases when it didn't work. I am not sure of the reason, maybe it's yarn's bug.
|
52 |
|
53 | This library is very robust because it goes the hard way.
|
54 |
|
55 |
|
56 | ## What if a package failed to install?
|
57 |
|
58 | In that case, that package will be skipped and an error message will be printed.
|
59 |
|
60 | You need to read the error message and manually install that package.
|
61 |
|
62 | It is the recommended flow. Because if a package failed to install, most of the time, you need to manually troubleshoot the issue and fix the issue.
|
63 |
|
64 |
|
65 | ## Ingore some packages
|
66 |
|
67 | You can add the following to `package.json` file:
|
68 |
|
69 | ```json
|
70 | ...
|
71 | "yarn-upgrade-all": {
|
72 | "ignore": [
|
73 | "react"
|
74 | ]
|
75 | }
|
76 | ...
|
77 | ```
|
78 |
|
79 | With configuration above, `yarn-upgrade-all` won't upgrade `react` for you.
|