[Danger] Minor fixes (#12606)
* Don't download bundle stats from master on CI This was temporarily necessary in the past because we didn't have the logic that downloads actual *merge base* stats. We do have that now as part of the Danger script. So we can remove this. * Use absolute threshold for whether to show a change * Download master stats, but only for other master builds * Rewrite sizes
Dan Abramov committed
Apr 11, 2018 at 18:46 UTC
c27a99812e75e73d9fad88c97ac8b8db452012c1
4 files changed
+192
-175
dangerfile.js
+2
-4
@@ -117,14 +117,12 @@ function git(args) {
117
previousBuildResults
118
);
119
120
- const percentToWarrentShowing = 1;
120
const packagesToShow = results
121
.filter(
122
r =>
124
- Math.abs(r.prevFileSizeChange) >= percentToWarrentShowing ||
125
- Math.abs(r.prevGzipSizeChange) >= percentToWarrentShowing
123
+ Math.abs(r.prevFileSizeAbsoluteChange) >= 300 || // bytes
124
+ Math.abs(r.prevGzipSizeAbsoluteChange) >= 100 // bytes
125
)
127
-
126
.map(r => r.packageName);
127
128
if (packagesToShow.length) {
scripts/circleci/build.sh
+7
-4
@@ -2,10 +2,13 @@
2
3
set -e
4
5
-# Update the local size measurements to the master version
6
-# so that the size diff printed at the end of the build is
7
-# accurate.
8
-curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
5
+# On master, download the bundle sizes from last master build so that
6
+# the size printed in the CI logs for master commits is accurate.
7
+# We don't do it for pull requests because those are compared against
8
+# the merge base by Dangerfile instead. See https://github.com/facebook/react/pull/12606.
9
+if [ -z "$CI_PULL_REQUEST" ]; then
10
+ curl -o scripts/rollup/results.json http://react.zpao.com/builds/master/latest/results.json
11
+fi
12
13
yarn build --extract-errors
14
# Note: since we run the full build including extracting error codes,
scripts/rollup/results.json
+181
-167
@@ -4,358 +4,414 @@
4
"filename": "react.development.js",
5
"bundleType": "UMD_DEV",
6
"packageName": "react",
7
- "size": 56109,
8
- "gzip": 15450
7
+ "size": 56254,
8
+ "gzip": 15473
9
},
10
{
11
"filename": "react.production.min.js",
12
"bundleType": "UMD_PROD",
13
"packageName": "react",
14
- "size": 6868,
15
- "gzip": 2943
14
+ "size": 7164,
15
+ "gzip": 3039
16
},
17
{
18
"filename": "react.development.js",
19
"bundleType": "NODE_DEV",
20
"packageName": "react",
21
- "size": 46528,
22
- "gzip": 13045
21
+ "size": 46671,
22
+ "gzip": 13066
23
},
24
{
25
"filename": "react.production.min.js",
26
"bundleType": "NODE_PROD",
27
"packageName": "react",
28
- "size": 5664,
29
- "gzip": 2488
28
+ "size": 5668,
29
+ "gzip": 2468
30
},
31
{
32
"filename": "React-dev.js",
33
"bundleType": "FB_DEV",
34
"packageName": "react",
35
- "size": 45932,
36
- "gzip": 12533
35
+ "size": 46591,
36
+ "gzip": 12709
37
},
38
{
39
"filename": "React-prod.js",
40
"bundleType": "FB_PROD",
41
"packageName": "react",
42
- "size": 13342,
43
- "gzip": 3632
42
+ "size": 13749,
43
+ "gzip": 3815
44
},
45
{
46
"filename": "react-dom.development.js",
47
"bundleType": "UMD_DEV",
48
"packageName": "react-dom",
49
- "size": 621978,
50
- "gzip": 143326
49
+ "size": 623595,
50
+ "gzip": 143677
51
},
52
{
53
"filename": "react-dom.production.min.js",
54
"bundleType": "UMD_PROD",
55
"packageName": "react-dom",
56
- "size": 102120,
57
- "gzip": 32529
56
+ "size": 102431,
57
+ "gzip": 32690
58
},
59
{
60
"filename": "react-dom.development.js",
61
"bundleType": "NODE_DEV",
62
"packageName": "react-dom",
63
- "size": 605975,
64
- "gzip": 139071
63
+ "size": 607592,
64
+ "gzip": 139432
65
},
66
{
67
"filename": "react-dom.production.min.js",
68
"bundleType": "NODE_PROD",
69
"packageName": "react-dom",
70
- "size": 100836,
71
- "gzip": 31830
70
+ "size": 100859,
71
+ "gzip": 31809
72
},
73
{
74
"filename": "ReactDOM-dev.js",
75
"bundleType": "FB_DEV",
76
"packageName": "react-dom",
77
- "size": 627643,
78
- "gzip": 141697
77
+ "size": 632548,
78
+ "gzip": 142266
79
},
80
{
81
"filename": "ReactDOM-prod.js",
82
"bundleType": "FB_PROD",
83
"packageName": "react-dom",
84
- "size": 299593,
85
- "gzip": 55668
84
+ "size": 291357,
85
+ "gzip": 53487
86
},
87
{
88
"filename": "react-dom-test-utils.development.js",
89
"bundleType": "UMD_DEV",
90
"packageName": "react-dom",
91
- "size": 41796,
92
- "gzip": 12004
91
+ "size": 41729,
92
+ "gzip": 11969
93
},
94
{
95
"filename": "react-dom-test-utils.production.min.js",
96
"bundleType": "UMD_PROD",
97
"packageName": "react-dom",
98
- "size": 10641,
99
- "gzip": 3955
98
+ "size": 10898,
99
+ "gzip": 4054
100
},
101
{
102
"filename": "react-dom-test-utils.development.js",
103
"bundleType": "NODE_DEV",
104
"packageName": "react-dom",
105
- "size": 36533,
106
- "gzip": 10547
105
+ "size": 36466,
106
+ "gzip": 10518
107
},
108
{
109
"filename": "react-dom-test-utils.production.min.js",
110
"bundleType": "NODE_PROD",
111
"packageName": "react-dom",
112
- "size": 10185,
113
- "gzip": 3848
112
+ "size": 10150,
113
+ "gzip": 3820
114
},
115
{
116
"filename": "ReactTestUtils-dev.js",
117
"bundleType": "FB_DEV",
118
"packageName": "react-dom",
119
- "size": 37217,
120
- "gzip": 10615
119
+ "size": 37779,
120
+ "gzip": 10710
121
},
122
{
123
"filename": "react-dom-unstable-native-dependencies.development.js",
124
"bundleType": "UMD_DEV",
125
"packageName": "react-dom",
126
- "size": 62617,
127
- "gzip": 16436
126
+ "size": 62648,
127
+ "gzip": 16408
128
},
129
{
130
"filename": "react-dom-unstable-native-dependencies.production.min.js",
131
"bundleType": "UMD_PROD",
132
"packageName": "react-dom",
133
- "size": 11337,
134
- "gzip": 3916
133
+ "size": 11595,
134
+ "gzip": 4012
135
},
136
{
137
"filename": "react-dom-unstable-native-dependencies.development.js",
138
"bundleType": "NODE_DEV",
139
"packageName": "react-dom",
140
- "size": 58179,
141
- "gzip": 15156
140
+ "size": 58210,
141
+ "gzip": 15123
142
},
143
{
144
"filename": "react-dom-unstable-native-dependencies.production.min.js",
145
"bundleType": "NODE_PROD",
146
"packageName": "react-dom",
147
- "size": 10884,
148
- "gzip": 3780
147
+ "size": 10850,
148
+ "gzip": 3751
149
},
150
{
151
"filename": "ReactDOMUnstableNativeDependencies-dev.js",
152
"bundleType": "FB_DEV",
153
"packageName": "react-dom",
154
- "size": 57783,
155
- "gzip": 14756
154
+ "size": 58465,
155
+ "gzip": 14911
156
},
157
{
158
"filename": "ReactDOMUnstableNativeDependencies-prod.js",
159
"bundleType": "FB_PROD",
160
"packageName": "react-dom",
161
- "size": 26739,
162
- "gzip": 5365
161
+ "size": 26891,
162
+ "gzip": 5486
163
},
164
{
165
"filename": "react-dom-server.browser.development.js",
166
"bundleType": "UMD_DEV",
167
"packageName": "react-dom",
168
- "size": 103774,
169
- "gzip": 27138
168
+ "size": 103764,
169
+ "gzip": 27110
170
},
171
{
172
"filename": "react-dom-server.browser.production.min.js",
173
"bundleType": "UMD_PROD",
174
"packageName": "react-dom",
175
- "size": 15306,
176
- "gzip": 5871
175
+ "size": 15565,
176
+ "gzip": 5951
177
},
178
{
179
"filename": "react-dom-server.browser.development.js",
180
"bundleType": "NODE_DEV",
181
"packageName": "react-dom",
182
- "size": 92818,
183
- "gzip": 24838
182
+ "size": 92808,
183
+ "gzip": 24792
184
},
185
{
186
"filename": "react-dom-server.browser.production.min.js",
187
"bundleType": "NODE_PROD",
188
"packageName": "react-dom",
189
- "size": 14943,
190
- "gzip": 5712
189
+ "size": 14910,
190
+ "gzip": 5680
191
},
192
{
193
"filename": "ReactDOMServer-dev.js",
194
"bundleType": "FB_DEV",
195
"packageName": "react-dom",
196
- "size": 95891,
197
- "gzip": 24487
196
+ "size": 96452,
197
+ "gzip": 24626
198
},
199
{
200
"filename": "ReactDOMServer-prod.js",
201
"bundleType": "FB_PROD",
202
"packageName": "react-dom",
203
- "size": 33522,
204
- "gzip": 8329
203
+ "size": 32377,
204
+ "gzip": 7966
205
},
206
{
207
"filename": "react-dom-server.node.development.js",
208
"bundleType": "NODE_DEV",
209
"packageName": "react-dom",
210
- "size": 94786,
211
- "gzip": 25396
210
+ "size": 94776,
211
+ "gzip": 25351
212
},
213
{
214
"filename": "react-dom-server.node.production.min.js",
215
"bundleType": "NODE_PROD",
216
"packageName": "react-dom",
217
- "size": 15767,
218
- "gzip": 6013
217
+ "size": 15734,
218
+ "gzip": 5984
219
},
220
{
221
"filename": "react-art.development.js",
222
"bundleType": "UMD_DEV",
223
"packageName": "react-art",
224
- "size": 420342,
225
- "gzip": 91083
224
+ "size": 421968,
225
+ "gzip": 91538
226
},
227
{
228
"filename": "react-art.production.min.js",
229
"bundleType": "UMD_PROD",
230
"packageName": "react-art",
231
- "size": 92061,
232
- "gzip": 28038
231
+ "size": 92491,
232
+ "gzip": 28243
233
},
234
{
235
"filename": "react-art.development.js",
236
"bundleType": "NODE_DEV",
237
"packageName": "react-art",
238
- "size": 344399,
239
- "gzip": 71874
238
+ "size": 346021,
239
+ "gzip": 72305
240
},
241
{
242
"filename": "react-art.production.min.js",
243
"bundleType": "NODE_PROD",
244
"packageName": "react-art",
245
- "size": 56045,
245
+ "size": 56188,
246
"gzip": 17231
247
},
248
{
249
"filename": "ReactART-dev.js",
250
"bundleType": "FB_DEV",
251
"packageName": "react-art",
252
- "size": 350895,
253
- "gzip": 71370
252
+ "size": 354425,
253
+ "gzip": 71881
254
},
255
{
256
"filename": "ReactART-prod.js",
257
"bundleType": "FB_PROD",
258
"packageName": "react-art",
259
- "size": 176846,
260
- "gzip": 29583
259
+ "size": 171232,
260
+ "gzip": 28356
261
},
262
{
263
"filename": "ReactNativeRenderer-dev.js",
264
"bundleType": "RN_DEV",
265
"packageName": "react-native-renderer",
266
- "size": 476799,
267
- "gzip": 102295
266
+ "size": 467421,
267
+ "gzip": 99671
268
},
269
{
270
"filename": "ReactNativeRenderer-prod.js",
271
"bundleType": "RN_PROD",
272
"packageName": "react-native-renderer",
273
- "size": 228487,
274
- "gzip": 38740
273
+ "size": 223136,
274
+ "gzip": 37494
275
+ },
276
+ {
277
+ "filename": "ReactFabric-dev.js",
278
+ "bundleType": "RN_DEV",
279
+ "packageName": "react-native-renderer",
280
+ "size": 449407,
281
+ "gzip": 95153
282
+ },
283
+ {
284
+ "filename": "ReactFabric-prod.js",
285
+ "bundleType": "RN_PROD",
286
+ "packageName": "react-native-renderer",
287
+ "size": 205039,
288
+ "gzip": 34306
289
+ },
290
+ {
291
+ "filename": "react-test-renderer.development.js",
292
+ "bundleType": "UMD_DEV",
293
+ "packageName": "react-test-renderer",
294
+ "size": 353820,
295
+ "gzip": 74198
296
+ },
297
+ {
298
+ "filename": "react-test-renderer.production.min.js",
299
+ "bundleType": "UMD_PROD",
300
+ "packageName": "react-test-renderer",
301
+ "size": 55917,
302
+ "gzip": 17071
303
},
304
{
305
"filename": "react-test-renderer.development.js",
306
"bundleType": "NODE_DEV",
307
"packageName": "react-test-renderer",
280
- "size": 342803,
281
- "gzip": 70878
308
+ "size": 344425,
309
+ "gzip": 71315
310
},
311
{
312
"filename": "react-test-renderer.production.min.js",
313
"bundleType": "NODE_PROD",
314
"packageName": "react-test-renderer",
287
- "size": 55008,
288
- "gzip": 16673
315
+ "size": 55145,
316
+ "gzip": 16660
317
},
318
{
319
"filename": "ReactTestRenderer-dev.js",
320
"bundleType": "FB_DEV",
321
"packageName": "react-test-renderer",
294
- "size": 349481,
295
- "gzip": 70442
322
+ "size": 353053,
323
+ "gzip": 70948
324
+ },
325
+ {
326
+ "filename": "react-test-renderer-shallow.development.js",
327
+ "bundleType": "UMD_DEV",
328
+ "packageName": "react-test-renderer",
329
+ "size": 24235,
330
+ "gzip": 6488
331
+ },
332
+ {
333
+ "filename": "react-test-renderer-shallow.production.min.js",
334
+ "bundleType": "UMD_PROD",
335
+ "packageName": "react-test-renderer",
336
+ "size": 7344,
337
+ "gzip": 2396
338
},
339
{
340
"filename": "react-test-renderer-shallow.development.js",
341
"bundleType": "NODE_DEV",
342
"packageName": "react-test-renderer",
301
- "size": 13766,
302
- "gzip": 3469
343
+ "size": 13661,
344
+ "gzip": 3416
345
},
346
{
347
"filename": "react-test-renderer-shallow.production.min.js",
348
"bundleType": "NODE_PROD",
349
"packageName": "react-test-renderer",
308
- "size": 6929,
309
- "gzip": 2270
350
+ "size": 6894,
351
+ "gzip": 2247
352
},
353
{
354
"filename": "ReactShallowRenderer-dev.js",
355
"bundleType": "FB_DEV",
356
"packageName": "react-test-renderer",
315
- "size": 14088,
316
- "gzip": 3437
357
+ "size": 14357,
358
+ "gzip": 3522
359
},
360
{
361
"filename": "react-noop-renderer.development.js",
362
"bundleType": "NODE_DEV",
363
"packageName": "react-noop-renderer",
322
- "size": 19617,
323
- "gzip": 5567
364
+ "size": 18834,
365
+ "gzip": 5202
366
},
367
{
368
"filename": "react-noop-renderer.production.min.js",
369
"bundleType": "NODE_PROD",
370
"packageName": "react-noop-renderer",
329
- "size": 6649,
330
- "gzip": 2619
371
+ "size": 6618,
372
+ "gzip": 2600
373
},
374
{
375
"filename": "react-reconciler.development.js",
376
"bundleType": "NODE_DEV",
377
"packageName": "react-reconciler",
336
- "size": 322717,
337
- "gzip": 66224
378
+ "size": 324339,
379
+ "gzip": 66661
380
},
381
{
382
"filename": "react-reconciler.production.min.js",
383
"bundleType": "NODE_PROD",
384
"packageName": "react-reconciler",
343
- "size": 47723,
344
- "gzip": 14603
385
+ "size": 47868,
386
+ "gzip": 14571
387
+ },
388
+ {
389
+ "filename": "react-reconciler-persistent.development.js",
390
+ "bundleType": "NODE_DEV",
391
+ "packageName": "react-reconciler",
392
+ "size": 323658,
393
+ "gzip": 66418
394
+ },
395
+ {
396
+ "filename": "react-reconciler-persistent.production.min.js",
397
+ "bundleType": "NODE_PROD",
398
+ "packageName": "react-reconciler",
399
+ "size": 46757,
400
+ "gzip": 14372
401
},
402
{
403
"filename": "react-reconciler-reflection.development.js",
404
"bundleType": "NODE_DEV",
405
"packageName": "react-reconciler",
350
- "size": 11033,
351
- "gzip": 3428
406
+ "size": 10946,
407
+ "gzip": 3398
408
},
409
{
410
"filename": "react-reconciler-reflection.production.min.js",
411
"bundleType": "NODE_PROD",
412
"packageName": "react-reconciler",
357
- "size": 2408,
358
- "gzip": 1062
413
+ "size": 2377,
414
+ "gzip": 1040
415
},
416
{
417
"filename": "react-call-return.development.js",
@@ -372,32 +428,18 @@
428
"gzip": 525
429
},
430
{
375
- "filename": "ReactFabric-dev.js",
376
- "bundleType": "RN_DEV",
377
- "packageName": "react-native-renderer",
378
- "size": 461645,
379
- "gzip": 98803
380
- },
381
- {
382
- "filename": "ReactFabric-prod.js",
383
- "bundleType": "RN_PROD",
384
- "packageName": "react-native-renderer",
385
- "size": 212373,
386
- "gzip": 35987
387
- },
388
- {
389
- "filename": "react-reconciler-persistent.development.js",
390
- "bundleType": "NODE_DEV",
391
- "packageName": "react-reconciler",
392
- "size": 322036,
393
- "gzip": 65980
431
+ "filename": "react-is.development.js",
432
+ "bundleType": "UMD_DEV",
433
+ "packageName": "react-is",
434
+ "size": 4384,
435
+ "gzip": 1253
436
},
437
{
396
- "filename": "react-reconciler-persistent.production.min.js",
397
- "bundleType": "NODE_PROD",
398
- "packageName": "react-reconciler",
399
- "size": 46619,
400
- "gzip": 14375
438
+ "filename": "react-is.production.min.js",
439
+ "bundleType": "UMD_PROD",
440
+ "packageName": "react-is",
441
+ "size": 1807,
442
+ "gzip": 748
443
},
444
{
445
"filename": "react-is.development.js",
@@ -414,25 +456,25 @@
456
"gzip": 684
457
},
458
{
417
- "filename": "react-is.development.js",
418
- "bundleType": "UMD_DEV",
459
+ "filename": "ReactIs-dev.js",
460
+ "bundleType": "FB_DEV",
461
"packageName": "react-is",
420
- "size": 4384,
421
- "gzip": 1253
462
+ "size": 4263,
463
+ "gzip": 1220
464
},
465
{
424
- "filename": "react-is.production.min.js",
425
- "bundleType": "UMD_PROD",
466
+ "filename": "ReactIs-prod.js",
467
+ "bundleType": "FB_PROD",
468
"packageName": "react-is",
427
- "size": 1807,
428
- "gzip": 748
469
+ "size": 3414,
470
+ "gzip": 953
471
},
472
{
473
"filename": "simple-cache-provider.development.js",
474
"bundleType": "NODE_DEV",
475
"packageName": "simple-cache-provider",
434
- "size": 5751,
435
- "gzip": 1863
476
+ "size": 5827,
477
+ "gzip": 1881
478
},
479
{
480
"filename": "simple-cache-provider.production.min.js",
@@ -441,47 +483,19 @@
483
"size": 1287,
484
"gzip": 650
485
},
444
- {
445
- "filename": "create-component-with-subscriptions.development.js",
446
- "bundleType": "NODE_DEV",
447
- "packageName": "create-component-with-subscriptions",
448
- "size": 9931,
449
- "gzip": 3067
450
- },
451
- {
452
- "filename": "create-component-with-subscriptions.production.min.js",
453
- "bundleType": "NODE_PROD",
454
- "packageName": "create-component-with-subscriptions",
455
- "size": 3783,
456
- "gzip": 1637
457
- },
486
{
487
"filename": "create-subscription.development.js",
488
"bundleType": "NODE_DEV",
489
"packageName": "create-subscription",
462
- "size": 5701,
463
- "gzip": 2024
490
+ "size": 5636,
491
+ "gzip": 1972
492
},
493
{
494
"filename": "create-subscription.production.min.js",
495
"bundleType": "NODE_PROD",
496
"packageName": "create-subscription",
469
- "size": 2634,
470
- "gzip": 1259
471
- },
472
- {
473
- "filename": "ReactIs-dev.js",
474
- "bundleType": "FB_DEV",
475
- "packageName": "react-is",
476
- "size": 4231,
477
- "gzip": 1200
478
- },
479
- {
480
- "filename": "ReactIs-prod.js",
481
- "bundleType": "FB_PROD",
482
- "packageName": "react-is",
483
- "size": 3382,
484
- "gzip": 932
497
+ "size": 2599,
498
+ "gzip": 1240
499
}
500
]
501
}
\ No newline at end of file
scripts/rollup/stats.js
+2
@@ -72,9 +72,11 @@ function generateResultsArray(current, prevResults) {
72
prevSize: filesize(prevSize),
73
prevFileSize: filesize(size),
74
prevFileSizeChange: fractionalChange(prevSize, size),
75
+ prevFileSizeAbsoluteChange: size - prevSize,
76
prevGzip: filesize(prevGzip),
77
prevGzipSize: filesize(gzip),
78
prevGzipSizeChange: fractionalChange(prevGzip, gzip),
79
+ prevGzipSizeAbsoluteChange: gzip - prevGzip,
80
};
81
// Strip any nulls
82
})