-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.babel.js
69 lines (59 loc) · 1.74 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import babel from 'gulp-babel';
import copy from 'gulp-copy';
import jsdoc from 'gulp-jsdoc3';
import jsdocConfig from './jsdoc.json';
import clean from 'gulp-clean';
import gulpSequence from 'gulp-sequence';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import rename from 'gulp-rename';
import minify from 'gulp-minify';
gulp.task('default', ['build']);
gulp.task('compile', gulpSequence('copy', 'transpile'));
gulp.task('build', gulpSequence(
'clean',
'copy',
'transpile',
'doc',
'build:browser',
'compress:browser',
'copy:example:browser'
));
gulp.task('transpile', () =>
gulp.src(['src/*', 'src/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('dist')));
gulp.task('copy', () =>
gulp.src(['src/**/*.json'])
.pipe(copy('./dist', { prefix: 1 }))
.pipe(gulp.dest('dist')));
gulp.task('doc', () =>
gulp.src(['README.md', 'src/**/*.js', '!src/**/*.spec.js'], { read: false })
.pipe(jsdoc(jsdocConfig)));
gulp.task('clean', () =>
gulp.src(['doc', 'dist', 'examples/browser/corenlp.min.js'], { read: false })
.pipe(clean()));
gulp.task('build:browser', () =>
browserify('src/index.js', {
standalone: 'CoreNLP',
debug: false,
extensions: ['.js', '.json'],
})
.transform('babelify')
.bundle()
.pipe(source('index.browser.js'))
.pipe(gulp.dest('dist/')))
gulp.task('compress:browser', () =>
gulp.src('dist/index.browser.js')
.pipe(minify({
ext: {
src: '.js',
min: '.min.js',
},
}))
.pipe(gulp.dest('dist')));
gulp.task('copy:example:browser', () =>
gulp.src('dist/index.browser.min.js')
.pipe(rename('corenlp.min.js'))
.pipe(gulp.dest('examples/browser')))