Skip to content
Snippets Groups Projects
Commit 5b6ff9a7 authored by João Victor Tozatti Risso's avatar João Victor Tozatti Risso
Browse files

Merge gulp branch with refactor_enrollments

parents ebcb4741 b9fe2843
No related branches found
No related tags found
1 merge request!7Refactor enrollments route to include query building
const gulp = require('gulp'); const gulp = require('gulp');
const babel = require('gulp-babel'); const babel = require('gulp-babel');
const eslint = require('gulp-eslint'); const eslint = require('gulp-eslint');
const mocha = require('gulp-mocha');
const nodemon = require('gulp-nodemon');
const Cache = require('gulp-file-cache');
const cache = new Cache();
/** /**
* Compile source files * Compile source files
*/ */
...@@ -13,8 +23,10 @@ function compile() { ...@@ -13,8 +23,10 @@ function compile() {
// compile source to ES5 // compile source to ES5
gulp.src('src/**/*.js') gulp.src('src/**/*.js')
.pipe(babel()) .pipe(cache.filter()) // cache source files
.pipe(gulp.dest('build')); .pipe(babel()) // compile only modified files
.pipe(cache.cache()) // cache compiled files
.pipe(gulp.dest('build')); // move compiled files to build directory
// copy configuration file to build directory // copy configuration file to build directory
gulp.src('config.json') gulp.src('config.json')
...@@ -24,14 +36,37 @@ function compile() { ...@@ -24,14 +36,37 @@ function compile() {
gulp.task('build', compile); gulp.task('build', compile);
gulp.task('run', ['build'], () => { gulp.task('test', () => {
gulp.src('test/test.js', {read: false})
.pipe(mocha())
.once('error', () => {
process.exit(1);
})
.once('end', () => {
process.exit();
});
}); });
gulp.task('watch', [], () => { gulp.task('watch', [], () => {
console.log('Watching source directory for changes');
compile(); compile();
gulp.watch('src/**/*.js').on('change', () => {
console.log('Recompiling source');
compile();
console.log('Source recompilation done')
});
}); });
gulp.task('test', ['build'], () => { gulp.task('run', () => {
process.chdir('build');
nodemon({
script: 'server.js',
tasks: ['watch'],
ignore: ["test/test.js", "gulpfile.babel.js"],
ext: 'js html json',
env: { 'NODE_ENV': 'development' }
});
}); });
gulp.task('default', ['watch']); gulp.task('default', ['run']);
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
"cors": "^2.7.1", "cors": "^2.7.1",
"csv-express": "^1.1.0", "csv-express": "^1.1.0",
"debug": "~2.0.x", "debug": "~2.0.x",
"dirty-chai": "^1.2.2",
"express": "^4.13.0", "express": "^4.13.0",
"faker": "^2.1.5", "faker": "^2.1.5",
"forever": "^0.15.2", "forever": "^0.15.2",
...@@ -44,6 +45,12 @@ ...@@ -44,6 +45,12 @@
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-babel": "^6.1.2", "gulp-babel": "^6.1.2",
"gulp-cli": "^1.2.2", "gulp-cli": "^1.2.2",
"gulp-eslint": "^3.0.1" "gulp-eslint": "^3.0.1",
"gulp-file-cache": "0.0.1",
"gulp-mocha": "^3.0.1",
"gulp-nodemon": "^2.1.0",
"gulp-plumber": "^1.1.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^2.0.0"
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment