forked from beauby/jsonapi-datastore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
78 lines (69 loc) · 2.1 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var gulp = require('gulp'),
gulpbabel = require('gulp-babel'),
babel = require('babel/register');
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
mocha = require('gulp-mocha'),
wrap = require('gulp-wrap'),
beautify = require('gulp-jsbeautify'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs'),
markdox = require('gulp-markdox');
var SRC = 'src/jsonapi-datastore.js',
DEST = 'dist/';
gulp.task('build', ['jshint', 'jscs'], function() {
return gulp.src(SRC)
.pipe(gulpbabel())
.pipe(concat('jsonapi-datastore.js'))
.pipe(gulp.dest(DEST))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(DEST));
});
gulp.task('build-angular', ['build'], function() {
return gulp.src('dist/jsonapi-datastore.js')
.pipe(gulpbabel())
.pipe(concat('ng-jsonapi-datastore.js'))
.pipe(wrap({ src: 'src/angular-wrapper.js' }))
.pipe(beautify({ indent_size: 2 }))
.pipe(gulp.dest(DEST))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(DEST));
});
gulp.task('build-node', ['build'], function() {
return gulp.src('dist/jsonapi-datastore.js')
.pipe(gulpbabel())
.pipe(concat('node-jsonapi-datastore.js'))
.pipe(wrap({ src: 'src/node-wrapper.js' }))
.pipe(beautify({ indent_size: 2 }))
.pipe(gulp.dest(DEST))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(DEST));
});
gulp.task('test', ['build'], function() {
gulp.src('test/*.spec.js')
.pipe(gulpbabel())
.pipe(mocha({compilers: { js: babel }}));
});
gulp.task('jscs', function() {
return gulp.src(SRC)
.pipe(gulpbabel())
.pipe(jscs());
});
gulp.task('jshint', function() {
return gulp.src(SRC)
.pipe(gulpbabel())
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('doc', function() {
return gulp.src(SRC)
.pipe(gulpbabel())
.pipe(markdox())
.pipe(concat("DOCUMENTATION.md"))
.pipe(gulp.dest('.'));
});
gulp.task('default', ['test', 'build', 'build-angular', 'build-node', 'doc']);