const gulp = require('gulp');
const zip = require('gulp-zip');
const del = require('del');


const appName = 'sdi-web-client-docs';
const distDir = `../../../../dist/${appName}/war`;
const srcDir = `../../../../dist/${appName}/code-examples`;


function clean() {
    return del(`${distDir}/**/*`, { force: true });
}

function war() {
    return gulp.src([`${srcDir}/**/*`])
        .pipe(zip(`${appName}.war`))
        .pipe(gulp.dest(distDir));
}


/***** Export tasks *****/
exports.default = gulp.series(
    clean,
    war,
    function report(cb) {
        console.info(`\nSuccessfully built!\n`);
        cb();
    }
);
