forked from talyssonoc/react-katex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
85 lines (75 loc) · 1.86 KB
/
gulpfile.js
File metadata and controls
85 lines (75 loc) · 1.86 KB
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
79
80
81
82
83
84
85
var path = require('path');
var gulp = require('gulp');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var jest = require('gulp-jest');
var jshint = require('gulp-jshint');
var jsx = require('gulp-react');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var umd = require('gulp-umd');
gulp.task('clean', function () {
return gulp.src('dist', { read: false })
.pipe(clean());
});
gulp.task('lint', function() {
return gulp.src('src/react-katex.jsx')
.pipe(jsx())
.pipe(jshint())
.pipe(jshint.reporter('default', { verbose: true }));
});
gulp.task('build', function() {
return gulp.src('src/react-katex.jsx')
.pipe(jsx())
.pipe(concat('react-katex.js'))
.pipe(umd({
exports: function(file) {
return 'ReactKaTeX';
},
namespace: function() {
return 'ReactKaTeX';
},
dependencies: function() {
return [
{
name: 'react-with-addons',
amd: 'react-with-addons',
cjs: 'react/addons',
global: 'React',
param: 'React'
},
{
name: 'katex-build',
amd: 'katex-build',
cjs: 'katex-build',
global: 'katex',
param: 'katex'
}
];
},
template: path.join(__dirname, '/src/umd-template.js')
}))
.pipe(gulp.dest('dist'))
.pipe(rename('react-katex.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function() {
gulp.watch('src/**.jsx', ['build']);
});
gulp.task('test', ['build'], function () {
return gulp.src('test').pipe(jest({
scriptPreprocessor: 'support/preprocessor.js',
unmockedModulePathPatterns: [
'node_modules/react'
],
testDirectoryName: 'test',
testPathIgnorePatterns: [
'node_modules',
'test/support'
],
moduleFileExtensions: [
'js'
]
}));
});