File tree 3 files changed +53
-1
lines changed 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change 6
6
dist
7
7
.DS_Store
8
8
maze_output
9
- * .ngsummary.json
9
+ * .ngsummary.json
10
+ .size
Original file line number Diff line number Diff line change
1
+ language : node_js
2
+ node_js :
3
+ - " 12"
4
+ before_script :
5
+ - mkdir .size
6
+ - npx lerna bootstrap --ignore @bugsnag/expo
7
+ - npx lerna run build --scope @bugsnag/browser
8
+ - cat packages/browser/dist/bugsnag.min.js | wc -c > .size/after-minified
9
+ - cat packages/browser/dist/bugsnag.min.js | gzip | wc -c > .size/after-gzipped
10
+ - git checkout $TRAVIS_BRANCH
11
+ - npm ci
12
+ - npx lerna bootstrap --ignore @bugsnag/expo
13
+ - npx lerna run build --scope @bugsnag/browser
14
+ - cat packages/browser/dist/bugsnag.min.js | wc -c > .size/before-minified
15
+ - cat packages/browser/dist/bugsnag.min.js | gzip | wc -c > .size/before-gzipped
16
+ - git checkout -
17
+ script :
18
+ - npx danger ci
Original file line number Diff line number Diff line change
1
+ /* global markdown */
2
+
3
+ const { readFileSync } = require ( 'fs' )
4
+
5
+ const before = {
6
+ minified : parseInt ( readFileSync ( `${ __dirname } /.size/before-minified` , 'utf8' ) . trim ( ) ) ,
7
+ gzipped : parseInt ( readFileSync ( `${ __dirname } /.size/before-gzipped` , 'utf8' ) . trim ( ) )
8
+ }
9
+
10
+ const after = {
11
+ minified : parseInt ( readFileSync ( `${ __dirname } /.size/after-minified` , 'utf8' ) . trim ( ) ) ,
12
+ gzipped : parseInt ( readFileSync ( `${ __dirname } /.size/after-gzipped` , 'utf8' ) . trim ( ) )
13
+ }
14
+
15
+ const formatKbs = ( n ) => ( n / 1000 ) . toFixed ( 2 )
16
+
17
+ const diffMinSize = before . minified - after . minified
18
+ const diffZipSize = before . gzipped - after . gzipped
19
+ const showDiff = n => {
20
+ if ( n > 0 ) return `⚠️ +${ n } bytes ⬆️`
21
+ if ( n < 0 ) return `-${ n } bytes ⬇️`
22
+ return 'No change'
23
+ }
24
+
25
+ markdown ( `
26
+ ### \`@bugsnag/browser\` bundle size diff
27
+
28
+ | | Minified | Minfied + Gzipped |
29
+ |--------|-------------------------------|------------------------------|
30
+ | Before | ${ formatKbs ( before . minified ) } | ${ formatKbs ( before . gzipped ) } |
31
+ | After | ${ formatKbs ( after . minified ) } | ${ formatKbs ( after . gzipped ) } |
32
+ | ± | ${ showDiff ( diffMinSize ) } | ${ showDiff ( diffZipSize ) } |
33
+ ` )
You can’t perform that action at this time.
0 commit comments