'use strict';

var gulp = require('gulp');
var gutil = require('gulp-util');
var exec = require('child_process').exec;



gulp.task('webpack-profile', function (done) {
    gutil.log("generating json file for visualizer");
    var filePath = './webpack-stats.json';
    var cmd = 'webpack --profile --json > ' + filePath;
    var options = {cwd: ""};
    exec(cmd, options, function (err, stdout, stderr) {
        gutil.log(stdout);
        gutil.log(stderr);
        gutil.log("Generated json file for visualizer at " + filePath);
        done();
    });
});