Skip to content

Instantly share code, notes, and snippets.

@jzerbe jzerbe/gulpfile.js
Created Mar 22, 2015

Embed
What would you like to do?
gulpfile.js used in conjunction with wGulp
// Initialize and use dependencies from "npm install"
var customizedOptions = {
languages: ['javascript', 'typescript'],
path: {
docs: './report/docs/'
},
taskTree: {
'karma': {
include: ['express_start']
},
'test': ['preTest', 'karma', 'express_stop']
}
};
var gulp = require('gulp'),
wgulp = require('wGulp')(gulp, customizedOptions),
bg = require('gulp-bg'),
concat = require('gulp-concat'),
insert = require('gulp-insert'),
rename = require('gulp-rename'),
shell = require('gulp-shell'),
uglify = require('gulp-uglify'),
pkg = require('./package.json');
// overrides existing 'dist'! bundles/mins all transpiled output in one file
gulp.task('dist', ['clean', 'build'], function() {
return gulp.src(['build/src/SupportedMethods.js',
'build/src/annotation_upload_service.js',
'build/src/annotation_upload_util.js',
'build/src/Interfaces/*.js',
'build/src/Bundle/*.js',
'build/src/Task/Base.js',
'build/src/**/*.js'])
.pipe(concat(pkg.name + '.js'))
.pipe(insert.prepend('/** ' + pkg.name + ': ' + pkg.version + ' **/\n'))
.pipe(gulp.dest('./dist'))
.pipe(rename(pkg.name + '.min.js'))
.pipe(uglify())
.pipe(insert.prepend('function annotationLibVersion(){return "' + pkg.version + '"}'))
.pipe(gulp.dest('./dist'));
});
// test data server
gulp.task('express_start', ['preTest'], bg('node', './test_backend/server.js'));
gulp.task('express_stop', ['express_start', 'karma'], shell.task(['./test_backend/server_stop.sh']));
// wipe all dependencies
gulp.task('nuclear', shell.task(['rm -r jspm_packages', 'rm -r node_modules']));
// pull down all jspm deps and load all typescript defs
gulp.task('setup', shell.task(['./node_modules/jspm/jspm.js dl-loader',
'./node_modules/tsd/build/cli.js reinstall']));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.