forked from react-ga/react-ga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (47 loc) · 1.13 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');
var jscs = require('gulp-jscs');
var del = require('del');
var browserify = require('browserify');
var shim = require('browserify-shim');
var DEST = 'dist/';
var SRC = 'src/**/*.js';
var TEST = 'test/**/*.js';
var PKG = 'react-ga';
var LINT_DIRS = [
SRC,
TEST
];
var TEST_TASKS = [
'jscs'
];
var BUILD_TASKS = [
'jscs',
'clean',
'package'
];
gulp.task('jscs', function () {
return gulp.src(LINT_DIRS)
.pipe(jscs())
.pipe(jscs.reporter());
});
gulp.task('clean', function () {
return del([DEST]);
});
gulp.task('package', function () {
return browserify('./src/index.js', {
standalone: 'ReactGA'
})
.transform(shim)
.bundle()
.pipe(source(PKG + '.js'))
.pipe(gulp.dest(DEST))
.pipe(rename(PKG + '.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest(DEST));
});
gulp.task('test', TEST_TASKS);
gulp.task('build', BUILD_TASKS);