build(analytics): track bundle size

This will send bundle sizes (before and after gzip) to Google Analytics so that we can
track bundle size over time for every bundle we produce.

Closes #5294
This commit is contained in:
Igor Minar 2015-11-15 02:27:59 -08:00
parent 96076862cf
commit 41dfaf393b
5 changed files with 1065 additions and 9 deletions

View File

@ -1045,6 +1045,37 @@ gulp.task('!bundle.copy', function() {
gulp.src('dist/js/bundle/**').pipe(gulp.dest('dist/js/dev/es5/bundle'))); gulp.src('dist/js/bundle/**').pipe(gulp.dest('dist/js/dev/es5/bundle')));
}); });
gulp.task('!bundles.js.checksize', function() {
var gzip = require('gulp-gzip');
var path = require('path');
return merge2(gulp.src('dist/js/bundle/**').on('data', checkFileSizeFactory('uncompressed')),
gulp.src('dist/js/bundle/**')
.pipe(gzip({gzipOptions: {level: 1}})) // code.angular.js
.on('data', checkFileSizeFactory('gzip level=1')),
gulp.src('dist/js/bundle/**')
.pipe(gzip({gzipOptions: {level: 2}})) // github pages, most common
.on('data', checkFileSizeFactory('gzip level=2', true)),
gulp.src('dist/js/bundle/**')
.pipe(gzip({gzipOptions: {level: 6}})) // default gzip level
.on('data', checkFileSizeFactory('gzip level=6')),
gulp.src('dist/js/bundle/**')
.pipe(gzip({gzipOptions: {level: 9}})) // max gzip level
.on('data', checkFileSizeFactory('gzip level=9')));
function checkFileSizeFactory(compressionLevel, printToConsole) {
return function checkFileSize(file) {
if (file.isNull()) return;
var filePath =
path.relative(path.join('dist', 'js', 'bundle'), file.path).replace('\.gz', '');
analytics.bundleSize(filePath, file.contents.length, compressionLevel);
if (printToConsole) {
console.log(` ${filePath} => ${file.contents.length} bytes (${compressionLevel})`)
}
}
}
});
gulp.task('bundles.js', gulp.task('bundles.js',
[ [
'!bundle.js.prod.deps', '!bundle.js.prod.deps',
@ -1054,7 +1085,7 @@ gulp.task('bundles.js',
'!bundle.js.sfx.dev.deps', '!bundle.js.sfx.dev.deps',
'!bundle.testing' '!bundle.testing'
], ],
function(done) { runSequence('!bundle.copy', done); }); function(done) { runSequence('!bundle.copy', '!bundles.js.checksize', done); });
gulp.task('build.js', gulp.task('build.js',
['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundles.js', 'benchpress.bundle']); ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundles.js', 'benchpress.bundle']);

View File

@ -6852,6 +6852,412 @@
} }
} }
}, },
"gulp-gzip": {
"version": "1.2.0",
"dependencies": {
"bytes": {
"version": "0.3.0"
},
"gulp-util": {
"version": "2.2.20",
"dependencies": {
"chalk": {
"version": "0.5.1",
"dependencies": {
"ansi-styles": {
"version": "1.1.0"
},
"escape-string-regexp": {
"version": "1.0.3"
},
"has-ansi": {
"version": "0.1.0",
"dependencies": {
"ansi-regex": {
"version": "0.2.1"
}
}
},
"strip-ansi": {
"version": "0.3.0",
"dependencies": {
"ansi-regex": {
"version": "0.2.1"
}
}
},
"supports-color": {
"version": "0.2.0"
}
}
},
"dateformat": {
"version": "1.0.11",
"dependencies": {
"get-stdin": {
"version": "5.0.1"
},
"meow": {
"version": "3.5.0",
"dependencies": {
"camelcase-keys": {
"version": "1.0.0",
"dependencies": {
"camelcase": {
"version": "1.2.1"
},
"map-obj": {
"version": "1.0.1"
}
}
},
"loud-rejection": {
"version": "1.2.0",
"dependencies": {
"signal-exit": {
"version": "2.1.2"
}
}
},
"minimist": {
"version": "1.2.0"
},
"normalize-package-data": {
"version": "2.3.5",
"dependencies": {
"hosted-git-info": {
"version": "2.1.4"
},
"is-builtin-module": {
"version": "1.0.0",
"dependencies": {
"builtin-modules": {
"version": "1.1.0"
}
}
},
"validate-npm-package-license": {
"version": "3.0.1",
"dependencies": {
"spdx-correct": {
"version": "1.0.2",
"dependencies": {
"spdx-license-ids": {
"version": "1.1.0"
}
}
},
"spdx-expression-parse": {
"version": "1.0.1",
"dependencies": {
"spdx-exceptions": {
"version": "1.0.4"
},
"spdx-license-ids": {
"version": "1.1.0"
}
}
}
}
}
}
},
"object-assign": {
"version": "4.0.1"
},
"read-pkg-up": {
"version": "1.0.1",
"dependencies": {
"find-up": {
"version": "1.1.0",
"dependencies": {
"path-exists": {
"version": "2.1.0"
},
"pinkie-promise": {
"version": "2.0.0",
"dependencies": {
"pinkie": {
"version": "2.0.0"
}
}
}
}
},
"read-pkg": {
"version": "1.1.0",
"dependencies": {
"load-json-file": {
"version": "1.1.0",
"dependencies": {
"graceful-fs": {
"version": "4.1.2"
},
"parse-json": {
"version": "2.2.0",
"dependencies": {
"error-ex": {
"version": "1.3.0",
"dependencies": {
"is-arrayish": {
"version": "0.2.1"
}
}
}
}
},
"pify": {
"version": "2.3.0"
},
"pinkie-promise": {
"version": "2.0.0",
"dependencies": {
"pinkie": {
"version": "2.0.0"
}
}
},
"strip-bom": {
"version": "2.0.0",
"dependencies": {
"is-utf8": {
"version": "0.2.0"
}
}
}
}
},
"path-type": {
"version": "1.1.0",
"dependencies": {
"graceful-fs": {
"version": "4.1.2"
},
"pify": {
"version": "2.3.0"
},
"pinkie-promise": {
"version": "2.0.0",
"dependencies": {
"pinkie": {
"version": "2.0.0"
}
}
}
}
}
}
}
}
},
"redent": {
"version": "1.0.0",
"dependencies": {
"indent-string": {
"version": "2.1.0",
"dependencies": {
"repeating": {
"version": "2.0.0",
"dependencies": {
"is-finite": {
"version": "1.0.1",
"dependencies": {
"number-is-nan": {
"version": "1.0.0"
}
}
}
}
}
}
},
"strip-indent": {
"version": "1.0.1",
"dependencies": {
"get-stdin": {
"version": "4.0.1"
}
}
}
}
},
"trim-newlines": {
"version": "1.0.0"
}
}
}
}
},
"lodash._reinterpolate": {
"version": "2.4.1"
},
"lodash.template": {
"version": "2.4.1",
"dependencies": {
"lodash.defaults": {
"version": "2.4.1",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1"
}
}
},
"lodash.escape": {
"version": "2.4.1",
"dependencies": {
"lodash._escapehtmlchar": {
"version": "2.4.1",
"dependencies": {
"lodash._htmlescapes": {
"version": "2.4.1"
}
}
},
"lodash._reunescapedhtml": {
"version": "2.4.1",
"dependencies": {
"lodash._htmlescapes": {
"version": "2.4.1"
}
}
}
}
},
"lodash._escapestringchar": {
"version": "2.4.1"
},
"lodash.keys": {
"version": "2.4.1",
"dependencies": {
"lodash._isnative": {
"version": "2.4.1"
},
"lodash.isobject": {
"version": "2.4.1",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1"
}
}
},
"lodash._shimkeys": {
"version": "2.4.1",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1"
}
}
}
}
},
"lodash.templatesettings": {
"version": "2.4.1"
},
"lodash.values": {
"version": "2.4.1"
}
}
},
"minimist": {
"version": "0.2.0"
},
"multipipe": {
"version": "0.1.2",
"dependencies": {
"duplexer2": {
"version": "0.0.2",
"dependencies": {
"readable-stream": {
"version": "1.1.13",
"dependencies": {
"core-util-is": {
"version": "1.0.1"
},
"isarray": {
"version": "0.0.1"
},
"string_decoder": {
"version": "0.10.31"
},
"inherits": {
"version": "2.0.1"
}
}
}
}
}
}
},
"through2": {
"version": "0.5.1",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"dependencies": {
"core-util-is": {
"version": "1.0.1"
},
"isarray": {
"version": "0.0.1"
},
"string_decoder": {
"version": "0.10.31"
},
"inherits": {
"version": "2.0.1"
}
}
},
"xtend": {
"version": "3.0.0"
}
}
},
"vinyl": {
"version": "0.2.3",
"dependencies": {
"clone-stats": {
"version": "0.0.1"
}
}
}
}
},
"stream-to-array": {
"version": "1.0.0"
},
"through2": {
"version": "0.4.2",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"dependencies": {
"core-util-is": {
"version": "1.0.1"
},
"isarray": {
"version": "0.0.1"
},
"string_decoder": {
"version": "0.10.31"
},
"inherits": {
"version": "2.0.1"
}
}
},
"xtend": {
"version": "2.1.2",
"dependencies": {
"object-keys": {
"version": "0.4.0"
}
}
}
}
}
}
},
"gulp-insert": { "gulp-insert": {
"version": "0.5.0", "version": "0.5.0",
"dependencies": { "dependencies": {

618
npm-shrinkwrap.json generated
View File

@ -10511,6 +10511,620 @@
} }
} }
}, },
"gulp-gzip": {
"version": "1.2.0",
"from": "gulp-gzip@*",
"resolved": "https://registry.npmjs.org/gulp-gzip/-/gulp-gzip-1.2.0.tgz",
"dependencies": {
"bytes": {
"version": "0.3.0",
"from": "bytes@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-0.3.0.tgz"
},
"gulp-util": {
"version": "2.2.20",
"from": "gulp-util@>=2.2.14 <3.0.0",
"resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-2.2.20.tgz",
"dependencies": {
"chalk": {
"version": "0.5.1",
"from": "chalk@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
"dependencies": {
"ansi-styles": {
"version": "1.1.0",
"from": "ansi-styles@>=1.1.0 <2.0.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz"
},
"escape-string-regexp": {
"version": "1.0.3",
"from": "escape-string-regexp@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz"
},
"has-ansi": {
"version": "0.1.0",
"from": "has-ansi@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
}
}
},
"strip-ansi": {
"version": "0.3.0",
"from": "strip-ansi@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
}
}
},
"supports-color": {
"version": "0.2.0",
"from": "supports-color@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz"
}
}
},
"dateformat": {
"version": "1.0.11",
"from": "dateformat@>=1.0.7-1.2.3 <2.0.0",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz",
"dependencies": {
"get-stdin": {
"version": "5.0.1",
"from": "get-stdin@*",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz"
},
"meow": {
"version": "3.5.0",
"from": "meow@*",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.5.0.tgz",
"dependencies": {
"camelcase-keys": {
"version": "1.0.0",
"from": "camelcase-keys@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz",
"dependencies": {
"camelcase": {
"version": "1.2.1",
"from": "camelcase@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz"
},
"map-obj": {
"version": "1.0.1",
"from": "map-obj@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz"
}
}
},
"loud-rejection": {
"version": "1.2.0",
"from": "loud-rejection@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.2.0.tgz",
"dependencies": {
"signal-exit": {
"version": "2.1.2",
"from": "signal-exit@>=2.1.2 <3.0.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-2.1.2.tgz"
}
}
},
"minimist": {
"version": "1.2.0",
"from": "minimist@>=1.1.3 <2.0.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz"
},
"normalize-package-data": {
"version": "2.3.5",
"from": "normalize-package-data@>=2.3.4 <3.0.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz",
"dependencies": {
"hosted-git-info": {
"version": "2.1.4",
"from": "hosted-git-info@>=2.1.4 <3.0.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.4.tgz"
},
"is-builtin-module": {
"version": "1.0.0",
"from": "is-builtin-module@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"dependencies": {
"builtin-modules": {
"version": "1.1.0",
"from": "builtin-modules@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.0.tgz"
}
}
},
"validate-npm-package-license": {
"version": "3.0.1",
"from": "validate-npm-package-license@>=3.0.1 <4.0.0",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
"dependencies": {
"spdx-correct": {
"version": "1.0.2",
"from": "spdx-correct@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz",
"dependencies": {
"spdx-license-ids": {
"version": "1.1.0",
"from": "spdx-license-ids@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.1.0.tgz"
}
}
},
"spdx-expression-parse": {
"version": "1.0.1",
"from": "spdx-expression-parse@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.1.tgz",
"dependencies": {
"spdx-exceptions": {
"version": "1.0.4",
"from": "spdx-exceptions@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-1.0.4.tgz"
},
"spdx-license-ids": {
"version": "1.1.0",
"from": "spdx-license-ids@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.1.0.tgz"
}
}
}
}
}
}
},
"object-assign": {
"version": "4.0.1",
"from": "object-assign@>=4.0.1 <5.0.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.0.1.tgz"
},
"read-pkg-up": {
"version": "1.0.1",
"from": "read-pkg-up@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"dependencies": {
"find-up": {
"version": "1.1.0",
"from": "find-up@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.0.tgz",
"dependencies": {
"path-exists": {
"version": "2.1.0",
"from": "path-exists@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz"
},
"pinkie-promise": {
"version": "2.0.0",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"dependencies": {
"pinkie": {
"version": "2.0.0",
"from": "pinkie@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz"
}
}
}
}
},
"read-pkg": {
"version": "1.1.0",
"from": "read-pkg@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"dependencies": {
"load-json-file": {
"version": "1.1.0",
"from": "load-json-file@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"dependencies": {
"graceful-fs": {
"version": "4.1.2",
"from": "graceful-fs@>=4.1.2 <5.0.0",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz"
},
"parse-json": {
"version": "2.2.0",
"from": "parse-json@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
"dependencies": {
"error-ex": {
"version": "1.3.0",
"from": "error-ex@>=1.2.0 <2.0.0",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz",
"dependencies": {
"is-arrayish": {
"version": "0.2.1",
"from": "is-arrayish@>=0.2.1 <0.3.0",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz"
}
}
}
}
},
"pify": {
"version": "2.3.0",
"from": "pify@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz"
},
"pinkie-promise": {
"version": "2.0.0",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"dependencies": {
"pinkie": {
"version": "2.0.0",
"from": "pinkie@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz"
}
}
},
"strip-bom": {
"version": "2.0.0",
"from": "strip-bom@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"dependencies": {
"is-utf8": {
"version": "0.2.0",
"from": "is-utf8@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.0.tgz"
}
}
}
}
},
"path-type": {
"version": "1.1.0",
"from": "path-type@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"dependencies": {
"graceful-fs": {
"version": "4.1.2",
"from": "graceful-fs@>=4.1.2 <5.0.0",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz"
},
"pify": {
"version": "2.3.0",
"from": "pify@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz"
},
"pinkie-promise": {
"version": "2.0.0",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"dependencies": {
"pinkie": {
"version": "2.0.0",
"from": "pinkie@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz"
}
}
}
}
}
}
}
}
},
"redent": {
"version": "1.0.0",
"from": "redent@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
"dependencies": {
"indent-string": {
"version": "2.1.0",
"from": "indent-string@>=2.1.0 <3.0.0",
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz",
"dependencies": {
"repeating": {
"version": "2.0.0",
"from": "repeating@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.0.tgz",
"dependencies": {
"is-finite": {
"version": "1.0.1",
"from": "is-finite@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.1.tgz",
"dependencies": {
"number-is-nan": {
"version": "1.0.0",
"from": "number-is-nan@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz"
}
}
}
}
}
}
},
"strip-indent": {
"version": "1.0.1",
"from": "strip-indent@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
"dependencies": {
"get-stdin": {
"version": "4.0.1",
"from": "get-stdin@>=4.0.1 <5.0.0",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
}
}
}
}
},
"trim-newlines": {
"version": "1.0.0",
"from": "trim-newlines@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz"
}
}
}
}
},
"lodash._reinterpolate": {
"version": "2.4.1",
"from": "lodash._reinterpolate@>=2.4.1 <3.0.0",
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz"
},
"lodash.template": {
"version": "2.4.1",
"from": "lodash.template@>=2.4.1 <3.0.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz",
"dependencies": {
"lodash.defaults": {
"version": "2.4.1",
"from": "lodash.defaults@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1",
"from": "lodash._objecttypes@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz"
}
}
},
"lodash.escape": {
"version": "2.4.1",
"from": "lodash.escape@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz",
"dependencies": {
"lodash._escapehtmlchar": {
"version": "2.4.1",
"from": "lodash._escapehtmlchar@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._escapehtmlchar/-/lodash._escapehtmlchar-2.4.1.tgz",
"dependencies": {
"lodash._htmlescapes": {
"version": "2.4.1",
"from": "lodash._htmlescapes@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz"
}
}
},
"lodash._reunescapedhtml": {
"version": "2.4.1",
"from": "lodash._reunescapedhtml@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._reunescapedhtml/-/lodash._reunescapedhtml-2.4.1.tgz",
"dependencies": {
"lodash._htmlescapes": {
"version": "2.4.1",
"from": "lodash._htmlescapes@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz"
}
}
}
}
},
"lodash._escapestringchar": {
"version": "2.4.1",
"from": "lodash._escapestringchar@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._escapestringchar/-/lodash._escapestringchar-2.4.1.tgz"
},
"lodash.keys": {
"version": "2.4.1",
"from": "lodash.keys@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz",
"dependencies": {
"lodash._isnative": {
"version": "2.4.1",
"from": "lodash._isnative@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz"
},
"lodash.isobject": {
"version": "2.4.1",
"from": "lodash.isobject@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1",
"from": "lodash._objecttypes@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz"
}
}
},
"lodash._shimkeys": {
"version": "2.4.1",
"from": "lodash._shimkeys@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1",
"from": "lodash._objecttypes@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz"
}
}
}
}
},
"lodash.templatesettings": {
"version": "2.4.1",
"from": "lodash.templatesettings@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz"
},
"lodash.values": {
"version": "2.4.1",
"from": "lodash.values@>=2.4.1 <2.5.0",
"resolved": "https://registry.npmjs.org/lodash.values/-/lodash.values-2.4.1.tgz"
}
}
},
"minimist": {
"version": "0.2.0",
"from": "minimist@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.0.tgz"
},
"multipipe": {
"version": "0.1.2",
"from": "multipipe@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz",
"dependencies": {
"duplexer2": {
"version": "0.0.2",
"from": "duplexer2@0.0.2",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
"dependencies": {
"readable-stream": {
"version": "1.1.13",
"from": "readable-stream@>=1.1.9 <1.2.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
}
}
}
}
},
"through2": {
"version": "0.5.1",
"from": "through2@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.17 <1.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"xtend": {
"version": "3.0.0",
"from": "xtend@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
}
}
},
"vinyl": {
"version": "0.2.3",
"from": "vinyl@>=0.2.1 <0.3.0",
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.2.3.tgz",
"dependencies": {
"clone-stats": {
"version": "0.0.1",
"from": "clone-stats@>=0.0.1 <0.1.0",
"resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz"
}
}
}
}
},
"stream-to-array": {
"version": "1.0.0",
"from": "stream-to-array@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-1.0.0.tgz"
},
"through2": {
"version": "0.4.2",
"from": "through2@>=0.4.1 <0.5.0",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.4.2.tgz",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.17 <1.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"xtend": {
"version": "2.1.2",
"from": "xtend@>=2.1.1 <2.2.0",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
"dependencies": {
"object-keys": {
"version": "0.4.0",
"from": "object-keys@>=0.4.0 <0.5.0",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz"
}
}
}
}
}
}
},
"gulp-insert": { "gulp-insert": {
"version": "0.5.0", "version": "0.5.0",
"from": "https://registry.npmjs.org/gulp-insert/-/gulp-insert-0.5.0.tgz", "from": "https://registry.npmjs.org/gulp-insert/-/gulp-insert-0.5.0.tgz",
@ -17409,12 +18023,12 @@
}, },
"karma-browserstack-launcher": { "karma-browserstack-launcher": {
"version": "0.1.7", "version": "0.1.7",
"from": "karma-browserstack-launcher@latest", "from": "https://registry.npmjs.org/karma-browserstack-launcher/-/karma-browserstack-launcher-0.1.7.tgz",
"resolved": "https://registry.npmjs.org/karma-browserstack-launcher/-/karma-browserstack-launcher-0.1.7.tgz", "resolved": "https://registry.npmjs.org/karma-browserstack-launcher/-/karma-browserstack-launcher-0.1.7.tgz",
"dependencies": { "dependencies": {
"browserstack": { "browserstack": {
"version": "1.2.0", "version": "1.2.0",
"from": "browserstack@1.2.0", "from": "https://registry.npmjs.org/browserstack/-/browserstack-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/browserstack/-/browserstack-1.2.0.tgz" "resolved": "https://registry.npmjs.org/browserstack/-/browserstack-1.2.0.tgz"
} }
} }

View File

@ -60,6 +60,7 @@
"gulp-clang-format": "^1.0.23", "gulp-clang-format": "^1.0.23",
"gulp-concat": "^2.5.2", "gulp-concat": "^2.5.2",
"gulp-connect": "^1.0.10", "gulp-connect": "^1.0.10",
"gulp-gzip": "^1.2.0",
"gulp-insert": "^0.5.0", "gulp-insert": "^0.5.0",
"gulp-load-plugins": "^1.0.0", "gulp-load-plugins": "^1.0.0",
"gulp-rename": "^1.2.0", "gulp-rename": "^1.2.0",

View File

@ -99,7 +99,7 @@ function getDartVersion() {
} }
function recordEvent(eventType, actionCategory, actionName, duration) { function recordEvent(eventType, actionCategory, actionName, duration, label) {
// if universal-analytics is not yet installed, don't bother doing anything (e.g. when tracking initial npm install) // if universal-analytics is not yet installed, don't bother doing anything (e.g. when tracking initial npm install)
// build-analytics will however store the starting timestamp, so at least we can record the success/error event with duration // build-analytics will however store the starting timestamp, so at least we can record the success/error event with duration
if (!ua) return; if (!ua) return;
@ -111,19 +111,19 @@ function recordEvent(eventType, actionCategory, actionName, duration) {
switch (eventType) { switch (eventType) {
case 'start': case 'start':
visitor. visitor.
event(actionCategory, actionName + ' (start)', 'testLabel', null, customParams). event(actionCategory, actionName + ' (start)', label, null, customParams).
send(); send();
break; break;
case 'success': case 'success':
visitor. visitor.
event(actionCategory, actionName, 'testLabel', duration, customParams). event(actionCategory, actionName, label, duration, customParams).
timing(actionCategory, actionName, duration, customParams). timing(actionCategory, actionName, duration, label, customParams).
send(); send();
break; break;
case 'error': case 'error':
visitor. visitor.
event(actionCategory, actionName + ' (errored)', 'testLabel', duration, customParams). event(actionCategory, actionName + ' (errored)', label, duration, customParams).
timing(actionCategory, actionName, duration, customParams). timing(actionCategory, actionName, duration, label, customParams).
send(); send();
break; break;
default: default:
@ -168,5 +168,9 @@ module.exports = {
ciError: (actionName, duration) => { ciError: (actionName, duration) => {
recordEvent('success', 'ci', actionName, duration); recordEvent('success', 'ci', actionName, duration);
},
bundleSize: (filePath, sizeInBytes, compressionLevel) => {
recordEvent('success', 'payload', compressionLevel, sizeInBytes, filePath);
} }
}; };