-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (56 loc) · 1.63 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
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var jest = require('gulp-jest');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var debug = require('gulp-debug');
var path = require('path');
var jshint = require('gulp-jshint');
var scriptsDir = './src/**/*';
var buildDir = './dist';
var exampleDir = './example';
var testDir = './test';
gulp.task('watch', function() {
gulp.watch(scriptsDir, ['build']);
});
gulp.task('build', function () {
browserify({
entries: './src/react-dashboard.js',
extensions: ['.js']
})
.transform(babelify)
.bundle()
.pipe(source('react-dashboard.js'))
.pipe(gulp.dest('dist'))
});
gulp.task('compress', ['build'], function() {
gulp.src('dist/react-dashboard.js')
.pipe(streamify(uglify()))
.pipe(rename('react-dashboard.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('jest', function () {
var nodeModules = path.resolve('./node_modules');
return gulp.src('**')
.pipe(jest({
scriptPreprocessor: nodeModules + '/babel-jest',
testPathIgnorePatterns: [
"node_modules",
"test/support"
],
moduleFileExtensions: [
"jsx",
"js",
"json",
"react"
],
testDirectoryName: "test",
unmockedModulePathPatterns: [nodeModules + '/react']
}));
});
gulp.task('test', ['jest']);
gulp.task('default',['test']);
gulp.task('dist', ['build', 'compress']);