io-ui-jsonform
Version:
HTML JSON form submission polyfill based on http://darobin.github.io/formic/specs/json/ .
99 lines (79 loc) • 2.3 kB
JavaScript
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var nodemon = require('nodemon');
var karma = require('gulp-karma');
var coveralls = require('gulp-coveralls');
gulp.task('nodemon', function (cb) {
var called = false;
return nodemon({
script: 'app.js',
ignore: [
'Gulpfile.js',
'node_modules/'
]
})
.on('start', function () {
if (!called) {
called = true;
cb();
}
})
.on('restart', function () {
setTimeout(function () {
reload({ stream: false });
}, 1000);
});
});
gulp.task('browser-sync', gulp.series('nodemon', function() {
browserSync({
proxy: "localhost:3005", // local node app address
port: 4000, // use *different* port than above
notify: true
});
}));
// =============================================================================
// ================================= Tests =====================================
// =============================================================================
var testFiles = [
'test/test.js',
'src/**/*.js'
];
gulp.task('karma', function() {
// Be sure to return the stream
return gulp.src(testFiles)
.pipe(karma({
configFile: './karma.conf.js',
action: 'run',
singleRun: true
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
gulp.task('mocha' , function() {
});
gulp.task('istanbul' , function() {
});
// gulp.task('coveralls', function(){
// return gulp.src('./coverage/lcov/lcov.info')
// .pipe(coveralls());
// })
// =============================================================================
// ================================= Gulp =====================================
// =============================================================================
gulp.task('watch', function() {
gulp.watch('example/client/**/*.html', reload);
gulp.watch('example/client/**/*.css', reload);
});
gulp.task('test', gulp.series('karma','mocha','istanbul', function () {
}),
//function () {
console.log('done')
//}
);
// gulp.task('deploy', [], function () {
// });
gulp.task('default', gulp.series('browser-sync', 'watch'));