forked from machinomy/vynos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (57 loc) · 1.89 KB
/
gulpfile.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
'use strict'
const gulp = require('gulp')
const gutil = require('gulp-util')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
require('dotenv').config({ path: '.env' })
const BACKGROUND_PORT = require('./support/webpack').BACKGROUND_PORT
const HARNESS_PORT = require('./support/webpack').HARNESS_PORT
const INDEX = require('./support/package.webpack')
const EMBED = require('./support/webpack').EMBED
const FRAME = require('./support/webpack').FRAME
const WORKER = require('./support/webpack').WORKER
const HARNESS = require('./support/webpack').HARNESS
const COMPONENTS = [EMBED, FRAME, WORKER, INDEX]
gulp.task('build', callback => {
webpack(COMPONENTS).run((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((err, stats) => {
if (err) throw new gutil.PluginError('build:harness', err)
gutil.log('build:harness', stats.toString({
colors: true
}))
callback()
})
})
// Serve the Wallet at http://localhost:9999/webpack-dev-server
gulp.task('serve', () => {
const config = {
contentBase: 'vynos/',
hot: true,
stats: 'minimal',
lazy: false,
compress: true
}
new WebpackDevServer(webpack(COMPONENTS), config).listen(BACKGROUND_PORT, 'localhost', (err) => {
if (err) throw new gutil.PluginError('serve', err)
})
})
gulp.task('serve:harness', ['serve'], () => {
const config = {
contentBase: 'harness/',
stats: 'minimal',
lazy: false,
compress: true
}
new WebpackDevServer(webpack(HARNESS), config).listen(HARNESS_PORT, 'localhost', (err) => {
if(err) throw new gutil.PluginError('serve:harness', err)
gutil.log('webpack-dev-server', `The Wallet Harness runs on http://localhost:${HARNESS_PORT}`)
})
})