"use strict";

var gulp = require('gulp');

var m = require('../common.js');
var buildConfig = m.config.buildConfig;
var del = require('del');
var gutil = require('gulp-util');

gulp.task('clean', done => {
        var hashFiles = buildConfig.hashFile + '.*.sha1';
        var filesToClean = [buildConfig.publicDir, buildConfig.privateDir, hashFiles];

        var opts = {};

        var completionFunc = function() {
            gutil.log("Cleaned files in clean task: " + JSON.stringify(filesToClean));
            done();
        };

        var errorFunc = function(err) {
            gutil.log("Error cleaning build files: " + err);
        };

        del(filesToClean, opts).then(completionFunc, errorFunc);
   });
