forked from qiao/PathFinding.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
48 lines (40 loc) · 1.4 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
mocha = require('gulp-mocha'),
shell = require('gulp-shell'),
del = require('del');
gulp.task('clean', function(cb) {
del('lib/**/*.*', cb);
});
gulp.task('browserify', ['clean'], function(cb) {
return gulp.src('./src/PathFinding.js')
.pipe(browserify({ standalone: 'PF' }))
.pipe(rename('pathfinding-browserified.js'))
.pipe(gulp.dest('./lib/'), cb);
});
gulp.task('uglify', ['browserify'], function(cb) {
return gulp.src('./lib/pathfinding-browserified.js')
.pipe(uglify())
.pipe(rename('pathfinding-browser.min.js'))
.pipe(gulp.dest('./lib/'), cb);
});
gulp.task('scripts', ['clean', 'browserify', 'uglify'], function(cb) {
return gulp.src(['./src/banner', './lib/pathfinding-browserified.js'])
.pipe(concat('pathfinding-browser.js'))
.pipe(gulp.dest('./lib/'), cb);
});
gulp.task('compile', ['scripts'], function() {
del('./lib/pathfinding-browserified.js');
});
gulp.task('test', function () {
return gulp.src('./test/**/*.js', {read: false})
.pipe(mocha({reporter: 'spec', bail: true, globals: { should: require('should') }}));
});
gulp.task('bench', shell.task([
'node benchmark/benchmark.js'
]));
gulp.task('default', ['test', 'compile'], function() {
});