'use strict';

var del = require('del');
var gulp = require('gulp');
var runSequence = require('run-sequence');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');

// Gulp task to minify JavaScript files
gulp.task('scripts', function() {
  return gulp.src('./index.js')
    // Minify the file
    .pipe(uglify())
    .pipe(rename({ basename: "sppech2text", suffix: '.min' }))
    // Output
    .pipe(gulp.dest('./dist'))
});

// Clean output directory
gulp.task('clean', () => del(['dist']));

// Gulp task to minify all files
gulp.task('default', ['clean'], function () {
  runSequence(
    'scripts'
  );
});