77var path = require ( "path" ) ;
88var Insight = require ( "insight" ) ;
99var pkg = require ( "../package.json" ) ;
10- var asyncLib = require ( "async " ) ;
10+ var insightEvents = require ( "../analytics/events.js " ) ;
1111
1212var insight = new Insight ( {
1313 trackingCode : "UA-46921629-3" ,
@@ -334,17 +334,13 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
334334 }
335335 } ) ;
336336
337- asyncLib . forEach ( Object . keys ( options ) , function ( optionKey , cb ) {
338- insight . trackEvent ( "options" , optionKey , JSON . stringify ( options [ optionKey ] ) ) ;
339- cb ( ) ;
340- } ) ;
341-
342337 var webpack = require ( "../lib/webpack.js" ) ;
343338
344339 Error . stackTraceLimit = 30 ;
345340 var lastHash = null ;
346341 var compiler ;
347342 try {
343+ insightReporter . trackEvent ( insightEvents . buildEvent ( { action : "options-collected" , label : JSON . stringify ( options ) , value : 1 } ) ) ;
348344 compiler = webpack ( options ) ;
349345 } catch ( e ) {
350346 var WebpackOptionsValidationError = require ( "../lib/WebpackOptionsValidationError" ) ;
@@ -371,7 +367,7 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
371367 compiler . purgeInputFileSystem ( ) ;
372368 }
373369
374- insightReporter . trackEvent ( "compiler ", " build- end") ;
370+ insightReporter . trackEvent ( insightEvents . buildEvent ( { action : "build-end ", label : "compiler build end", value : 9999 } ) ) ;
375371 if ( err ) {
376372 lastHash = null ;
377373 console . error ( err . stack || err ) ;
@@ -402,7 +398,7 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
402398 compiler . watch ( watchOptions , compilerCallback ) ;
403399 console . log ( "\nWebpack is watching the files…\n" ) ;
404400 } else
405- insightReporter . trackEvent ( "compiler ", " build- start") ;
401+ insightReporter . trackEvent ( insightEvents . buildEvent ( { action : "build-start ", label : "compiler build start", value : 2 } ) ) ;
406402 compiler . run ( compilerCallback ) ;
407403 }
408404
@@ -413,5 +409,4 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
413409 } else {
414410 processOptions ( options , insight ) ;
415411 }
416-
417412} ) ;
0 commit comments