-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathgulpfile.js
More file actions
85 lines (70 loc) · 1.99 KB
/
gulpfile.js
File metadata and controls
85 lines (70 loc) · 1.99 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
'use strict';
const gulp = require('gulp'),
gutil = require('gulp-util'),
webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server'),
VYNOS_BACKGROUND = require('./webpack').VYNOS_BACKGROUND,
VYNOS_SDK = require('./webpack').VYNOS_SDK,
HARNESS = require('./webpack').HARNESS;
require('dotenv').config({path: '.env'});
const devserverPort = process.env.FRAME_PORT || '9090';
gulp.task('build', callback => {
webpack([VYNOS_BACKGROUND, VYNOS_SDK]).run(function (err, stats) {
if (err) {
throw new gutil.PluginError('build', err);
}
gutil.log('build', stats.toString({
colors: true
}));
callback();
});
});
gulp.task('build:harness', ['build'], callback => {
webpack(HARNESS).run(function (err, stats) {
if (err) {
throw new gutil.PluginError('build', err);
}
gutil.log('build:harness', stats.toString({
colors: true
}));
callback();
});
});
// Serve Vynos, Frame at http://localhost:9999/webpack-dev-server
gulp.task('serve', () => {
new WebpackDevServer(webpack([ VYNOS_BACKGROUND, VYNOS_SDK ]), {
contentBase: 'vynos/',
historyApiFallback: true,
quiet: false,
noInfo: false,
stats: {
assets: false,
colors: true,
version: false,
hash: false,
timings: false,
chunks: false,
chunkModules: false
},
compress: true
}).listen(devserverPort, 'localhost', function (err) {
if (err) {
throw new gutil.PluginError('build:serve', err);
}
gutil.log('webpack-dev-server', `http://localhost:${devserverPort}/`);
});
});
gulp.task('serve:harness', ['serve'], () => {
new WebpackDevServer(webpack(HARNESS), {
stats: {
colors: true
},
contentBase: 'harness/',
compress: true
}).listen(process.env.HARNESS_PORT, 'localhost', function (err) {
if (err) {
throw new gutil.PluginError('serve:harness', err);
}
gutil.log('webpack-dev-server', `http://localhost:${process.env.HARNESS_PORT}/`);
});
});