-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
82 lines (66 loc) · 2.26 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
70
71
72
73
74
75
76
77
78
79
80
81
82
'use strict';
import minimist from 'minimist';
import webpack from 'webpack';
import webpackDevServer from 'webpack-dev-server';
import webpackConfig from './webpack.config.js';
import gulp from 'gulp';
import gutil from 'gulp-util';
import gulpif from 'gulp-if';
import image from 'gulp-image';
import shell from 'gulp-shell';
import rename from 'gulp-rename';
const argv = minimist(process.argv.slice(2));
const isProduction = argv.release || false;
gulp.task('webpack:dev', ['sdk'], () => {
new webpackDevServer(webpack(webpackConfig), {
publicPath: '/',
contentBase: './dist',
hot: true,
historyApiFallback: true,
stats: {
colors: true
}
}).listen(3000, '0.0.0.0', (err) => {
if (err) {
throw new gutil.PluginError('[webpack:dev]', err);
}
gutil.log('[webpack:dev]', 'http://0.0.0.0:3000');
});
});
gulp.task('assets', ['html', 'sounds', 'images']);
gulp.task('sounds', ['sdk'], () => {
return gulp.src(['build/assets/sound/**/*'])
.pipe(gulp.dest('./dist/assets/sound'));
});
gulp.task('images', ['sdk'], () => {
return gulp.src(['build/assets/images/**/*'])
.pipe(gulpif(isProduction, image({svgo: false})))
.pipe(gulp.dest('./dist/assets/images'));
});
gulp.task('html', () => {
return gulp.src(['devapp/index.html'])
.pipe(gulp.dest('./dist/'));
});
gulp.task('workers', ['sdk'], () => {
return gulp.src([
//'build/workers/offline-worker.*',
//'build/workers/serviceworker-cache-polyfill.*',
'node_modules/opus-recorder/libopus.js',
'node_modules/opus-recorder/oggopusDecoder.js',
'node_modules/opus-recorder/oggopusEncoder.js',
'node_modules/opus-recorder/resampler.js'
])
.pipe(gulp.dest('./dist/'));
});
gulp.task('lib:build', shell.task('./gradlew :actor-sdk:sdk-core:core:core-js:buildPackage', {cwd: '../..'}));
gulp.task('lib:copy', ['lib:build'], () => {
return gulp.src(['../sdk-core/core/core-js/build/package/actor.nocache.js'])
.pipe(rename('actor.js'))
.pipe(gulp.dest('./node_modules/actor-js/'));
});
gulp.task('lib', ['lib:build', 'lib:copy']);
gulp.task('sdk', shell.task('npm run build'));
gulp.task('static', ['sdk', 'assets', 'workers']);
gulp.task('dev', ['static', 'webpack:dev']);
gulp.task('dev:core', ['lib', 'dev']);
gulp.task('default', ['dev']);