Skip to content

Improvements in gulp tasks #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
*/
const gulp = require('gulp');
const gutil = require('gulp-util');
const browserify = require('browserify');
const watchify = require('watchify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const browserSync = require('browser-sync');
const eslint = require('gulp-eslint');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');
const mocha = require('gulp-mocha');
const babel = require('gulp-babel');

const browserify = require('browserify');
const watchify = require('watchify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const browserSync = require('browser-sync');

/**
* function to handle errors from any task
*/
Expand Down Expand Up @@ -113,7 +114,9 @@ gulp.task('lint:failOnError', checkLint(true));
gulp.task('lint:noFailOnError', checkLint(false));

// default lint task
gulp.task('lint', ['lint:failOnError']);
gulp.task('lint', ['lint:failOnError'], function() {
gutil.log('No Lint Errors');
});

/**
* tasks to bundle all the javscript files
Expand All @@ -129,27 +132,32 @@ gulp.task('scripts:development', bundleJs({
}));

// from src directory to distribution directory - release/production mode
gulp.task('scripts:release', function() {
return gulp.src([
gulp.task('scripts:release', ['lint:failOnError', 'test'] , function() {
gulp.src([
'src/**/*.js',
'src/**/*.jsx',
])
.pipe(babel())
.pipe(gulp.dest('dist'));

gutil.log('Scripts released into dist folder');
});

/**
* task to initial tests using mocha
*/

gulp.task('test', function() {
gulp.src([
gulp.task('test', function(done) {
return gulp.src([
'test/.setup.js',
'test/**/*.test.js',
])
.pipe(mocha({
require: 'babel-core/register',
}));
}))
.once('error', () => {
process.exit(1);
});
});

/**
Expand Down