-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
60 lines (51 loc) · 1.49 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
import gulp from 'gulp';
import gutil from 'gulp-util';
import babel from 'gulp-babel';
import browserify from 'gulp-browserify';
import rename from 'gulp-rename';
import connect from 'gulp-connect';
import gbump from 'gulp-bump';
gulp.task('watch', () => {
gulp.watch('./src/**/*', ['build']);
gulp.watch('./test/**/*', ['build:tests']);
});
function bump(type) {
gulp.src(['./bower.json', './package.json'])
.pipe(gbump({type}))
.pipe(gulp.dest('./'));
}
gulp.task('bump:major', () => bump('major'));
gulp.task('bump:minor', () => bump('minor'));
gulp.task('bump:patch', () => bump('patch'));
gulp.task('build:node', () => {
gulp.src('./src/*.?(lit)coffee')
.pipe(babel().on('error', gutil.log))
.pipe(gulp.dest('./lib'));
});
gulp.task('build:browser', ['build:node'], () => {
gulp.src('./lib/*.js')
.pipe(browserify({
standalone: 'controlfacades',
transform: ['browserify-shim'],
}))
.pipe(rename('react-pressable.js'))
.pipe(gulp.dest('./standalone/'));
});
gulp.task('build:tests', () => {
gulp.src('./test/tests.js')
.pipe(babel().on('error', gutil.log))
.pipe(browserify({
transform: ['browserify-shim'],
}))
.pipe(rename('tests-compiled.js'))
.pipe(gulp.dest('./test/'));
});
// A server for the test page
gulp.task('testserver', () => {
connect.server({
root: [__dirname],
port: 1337,
});
});
gulp.task('test', ['build:browser', 'build:tests', 'testserver']);
gulp.task('build', ['build:node', 'build:browser']);