File size: 13,096 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# Update Project Dependencies

Updating the dependencies is a tedious job. This doc is intended to help streamline the process and make it painless.

## Maintain Update Log

There's a sample `Update Log` at the end of this document. Create a new file where you can dump the Version Diff, Test results, Chrome/Node/npm versions. Mention the dependencies that you had to roll back along with the reason. Optionally you can mention the errors/warnings that you encountered while updating dependencies.

## Managing Node Versions

It is recommended that you use [Node Version Manager](https://github.com/creationix/nvm) or [Node Version Control](https://github.com/tj/n) to switch node versions quickly in order to run and test this project on multiple node versions.

## Update Tooling

**Update npm:**

1.  Run `npm install -g npm`
2.  Run `npm -v` and record npm version in `Update Log`.

**Update Chrome**

1.  Download the [latest version](https://www.google.com/chrome/browser/desktop/index.html) or go to [chrome://settings/](chrome://settings/) and update.

2.  Go to `Chrome -> About` and record version number in `Update Log`

## Update Dependencies

[npm-check-updates](https://github.com/tjunnone/npm-check-updates) is a great tool to update your dependencies. It will only update your `package.json`. Run `npm install` if you want to install updated package versions. There are 3 useful commands.

1.  `ncu -u --semverLevel minor`
2.  `ncu -u --semverLevel major`
3.  `ncu -u`

Confirm/adjust eslint-config-airbnb compatible [dependency versions](https://www.npmjs.com/package/eslint-config-airbnb)

`npm info "eslint-config-airbnb@latest" peerDependencies`

### Pinned Version Numbers

`react-boilerplate` does not use "^", "~", etc., and these should be removed from `package.json`, if present. See [#598](https://github.com/react-boilerplate/react-boilerplate/issues/598) for more details.

At this point, you should copy and paste the version diff from the terminal into your `Update Log`.

## Correct Errors and Rollback Dependencies

Run `npm install` to install updated versions and then start the example app by running `npm start`. Make sure that the project is running smoothly. If not, track down the dependencies that are causing problems and try to roll them back one by one and check if the example application is running.

Note down the rolled back dependencies and state the reason in your `Update Log`.

## Full Regression Testing

Most of the errors/warnings would go away once you roll back the problemetic dependencies. But we need to make sure that the internal commands, tools, scaffolding etc. are functional too.

**Example App:**

- `rm -rf node_modules && rm package-lock.json`
- `npm install && npm start`

- Browse example app on development server
  - Browse Features page, change language to `de`
  - Browse NotFound page
- Browse example app on dev tunnel
- Browse example app on Production server
- Browse example app offline

Identify problems that occur and try to resolve them by rolling back the respective dependencies. Update the `Update Log`.

**Internal Commands:**

- `npm run clean` (Be careful, this will commit all your changes.)
- `npm run generate component` TestComp /w defaults
- `npm run generate container` TestPage /w defaults
- Add a new route in the App container:

```js
import TestPage from 'containers/TestPage/Loadable';

<Route path="/test" component={TestPage} />
```

- Use TestComp on TestPage -> bypass all tests in TestComp and TestPage (set true = true)
- `npm start` > `localhost:3000/test`
- `npm test` (expect test failure due to incomplete test coverage)
- `npm run build`
- `npm run start:prod` > `localhost:3000/test`

# Sample Update Log

## Tooling Versions

- Node 8.11.4
- npm 6.4.0
- Mac OS 10.13.6
- Chrome 68.0.3440.106 (64-bit)

## :spiral_notepad: Notes

1.  `react-router` was not updated. Thanks to @anuraaga for all his work. Ref- #1746
2.  `history` was not updated because of `react-router v3`'s dependency on it. Should go away when #1746 is merged.
3.  `react-test-renderer` was added as a dev-dependency because enzyme was showing warnings-
    > A few deprecation warnings were added in React 15.5. This supports the new APIs that React recommends. Ref. [#876](https://github.com/airbnb/enzyme/pull/876)
4.  If you see a package-name being repeated, note that the version number of the last occurrence will get precedence.

## :package: Version Diff

**[0] PATCH UPDATES**

```
 fontfaceobserver                        2.0.8  β†’    2.0.9
 ip                                      1.1.4  β†’    1.1.5
 react-redux                             5.0.2  β†’    5.0.5
 react-router                            3.0.2  β†’    3.0.5
 react-router-redux                      4.0.7  β†’    4.0.8
 react-router-scroll                     0.4.1  β†’    0.4.2
 redux-saga                             0.14.3  β†’   0.14.8
 whatwg-fetch                            2.0.2  β†’    2.0.3
 babel-plugin-dynamic-import-node        1.0.0  β†’    1.0.2
 coveralls                             2.11.15  β†’  2.11.16
 css-loader                             0.26.1  β†’   0.26.4
 exports-loader                          0.6.3  β†’    0.6.4
 file-loader                            0.10.0  β†’   0.10.1
 html-loader                             0.4.4  β†’    0.4.5
 imports-loader                          0.7.0  β†’    0.7.1
 lint-staged                             3.3.0  β†’    3.3.2
 ngrok                                   2.2.6  β†’    2.2.9
 offline-plugin                          4.6.1  β†’    4.6.2
 shelljs                                 0.7.6  β†’    0.7.7
 sinon                             2.0.0-pre.5  β†’    2.0.0
 style-loader                           0.13.1  β†’   0.13.2
 url-loader                              0.5.7  β†’    0.5.8
 webpack-dev-middleware                 1.10.0  β†’   1.10.2
```

**[1] MINOR UPDATES**

```
 babel-polyfill                                   6.22.0  β†’                 6.23.0
 cross-env                                         3.1.4  β†’                  3.2.4
 express                                          4.14.1  β†’                 4.15.3
 history                                           3.2.1  β†’                  3.3.0
 react                                            15.4.2  β†’                 15.5.4
 react-dom                                        15.4.2  β†’                 15.5.4
 react-intl                                        2.2.3  β†’                  2.3.0
 redux-immutable                                  3.0.11  β†’                  3.1.0
 redux-saga                                       0.14.8  β†’                 0.15.3
 babel-cli                                        6.22.2  β†’                 6.24.1
 babel-core                                       6.22.1  β†’                 6.24.1
 babel-eslint                                      7.1.1  β†’                  7.2.3
 babel-loader                                     6.2.10  β†’                  6.4.1
 babel-plugin-transform-es2015-modules-commonjs   6.22.0  β†’                 6.24.1
 babel-plugin-transform-react-constant-elements   6.22.0  β†’                 6.23.0
 babel-plugin-transform-react-remove-prop-types   0.2.12  β†’                  0.4.5
 babel-preset-env                                  1.4.0  β†’                  1.5.1
 babel-preset-react                               6.22.0  β†’                 6.24.1
 babel-preset-stage-0                             6.22.0  β†’                 6.24.1
 coveralls                                       2.11.16  β†’                 2.13.1
 css-loader                                       0.26.4  β†’                 0.28.4
 enzyme                                            2.7.1  β†’                  2.8.2
 eslint                                           3.13.1  β†’                 3.19.0
 eslint-config-airbnb                             14.0.0  β†’                 14.1.0
 eslint-config-airbnb-base                        11.0.1  β†’                 11.2.0
 eslint-plugin-import                              2.2.0  β†’                  2.3.0
 eslint-plugin-react                               6.9.0  β†’                 6.10.3
 file-loader                                      0.10.1  β†’                 0.11.1
 jest-cli                                         18.1.0  β†’  18.5.0-alpha.7da3df39
 lint-staged                                       3.3.2  β†’                  3.5.1
 node-plop                                         0.5.5  β†’                  0.7.0
 offline-plugin                                    4.6.2  β†’                  4.8.1
 plop                                              1.7.4  β†’                  1.8.0
 react-addons-test-utils                          15.4.2  β†’                 15.5.1
 rimraf                                            2.5.4  β†’                  2.6.1
 sinon                                             2.0.0  β†’                  2.3.2
 style-loader                                     0.13.2  β†’                 0.18.1
 webpack                                           2.2.1  β†’                  2.6.1
 webpack-hot-middleware                           2.16.1  β†’                 2.18.0
```

**[3] MAJOR UPDATES**

```
 cross-env                                   3.2.4  β†’       5.0.0
 history                                     3.3.0  β†’       4.6.1
 react-helmet                                4.0.0  β†’       5.1.3
 react-router                                3.0.5  β†’       4.1.1
 redux-immutable                             3.1.0  β†’       4.0.0
 reselect                                    2.5.4  β†’       3.0.1
 sanitize.css                                4.1.0  β†’       5.0.0
 babel-loader                                6.4.1  β†’       7.0.0
 circular-dependency-plugin                  2.0.0  β†’       3.0.0
 eslint-config-airbnb                       14.1.0  β†’      15.0.1
 eslint-plugin-jsx-a11y                      3.0.2  β†’       5.0.3
 eslint-plugin-react                        6.10.3  β†’       7.0.1
 image-webpack-loader                        2.0.0  β†’       3.3.1
 jest-cli                    18.5.0-alpha.7da3df39  β†’      20.0.4
```

**[4] ROLLBACKS**

```
 history                                     3.3.0  β†’       4.6.1 <--- rolled back
 react-router                                3.0.5  β†’       4.1.1 <--- rolled back
 image-webpack-loader                        2.0.0  β†’       3.0.0 <--- rolled back
```

**[5] NEW DEPENDENCIES**

```
react-test-renderer                                     15.5.4
```

## Errors Encountered

- Incompatible per `npm info "eslint-config-airbnb@latest" peerDependencies` adjust eslint-config-airbnb compatible dependency versions. see: https://www.npmjs.com/package/eslint-config-airbnb

  **_eslint 3.13.1 β†’ 3.15.0 <--- rolled back_**

- Error observed in Travis CI build

```bash
   ERROR in ./~/react-router-scroll/lib/StateStorage.js
   Module not found: Error: Can't resolve 'history/lib/DOMStateStorage' in '
   /home/travis/build/gihrig/react-boilerplate/node_modules/react-router-scroll/lib'
    @ ./~/react-router-scroll/lib/StateStorage.js 5:23-61
    @ ./~/react-router-scroll/lib/ScrollBehaviorContext.js
    @ ./~/react-router-scroll/lib/useScroll.js
    @ ./~/react-router-scroll/lib/index.js
    @ ./app/app.js
    @ multi ./app/app.js
```

- `history` Incompatible

  react-boilerplate@3.4.0 /Users/glen/Documents/JavaScript/Research/react-bp
  └── UNMET PEER DEPENDENCY history@4.5.1

  npm ERR! peer dep missing: history@^2.0.0 || ^3.0.0, required by react-router-scroll@0.4.1

  **_history 3.2.1 β†’ 4.5.1 <--- rolled back_**

Addressed here https://github.com/imagemin/imagemin-pngquant/issues/32 **_Needs Testing_**

- Error: (some OS X installations only, not version specific)

  Addressed here https://github.com/imagemin/imagemin-pngquant/issues/32, but throws warnings (below)

  In ./app/components/Header/banner.jpg
  Module build failed: Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: ~/react-boilerplate/node_modules/mozjpeg/vendor/cjpeg
  Reason: image not found

  **_image-webpack-loader 2.0.0 β†’ 3.0.0 <--- rolled back_**
  see: https://github.com/mxstbr/react-boilerplate/pull/1322#issuecomment-266264527 and #1335

- Warning: Observed on `npm start`

  WARNING in ./app/components/Header/banner.jpg
  DEPRECATED. Configure gifsicle's interlaced option in it's own options. (gifsicle.interlaced)
  @ ./app/components/Header/index.js 47:0-34
  @ ./app/containers/App/index.js
  @ ./app/app.js
  @ multi eventsource-polyfill webpack-hot-middleware/client?reload=true ./app/app.js
  WARNING in ./app/components/Header/banner.jpg
  DEPRECATED. Configure optipng's optimizationLevel option in it's own options. (optipng.optimizationLevel)
  @ ./app/components/Header/index.js 47:0-34
  @ ./app/containers/App/index.js
  @ ./app/app.js
  @ multi eventsource-polyfill webpack-hot-middleware/client?reload=true ./app/app.js

  **_image-webpack-loader 2.0.0 β†’ 3.2.0 <--- Rolled back_**