-
Notifications
You must be signed in to change notification settings - Fork 7
/
make.js
76 lines (66 loc) · 1.35 KB
/
make.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
var b = require('substance-bundler')
let path = require('path')
/*
Sub-tasks
*/
b.task('clean', function() {
b.rm('./dist')
})
b.task('assets', function() {
b.copy('./node_modules/font-awesome', './dist/font-awesome')
b.copy('app/index.html', './dist/index.html')
})
/*
Core tasks
*/
b.task('client', ['assets'], function() {
_client(false)
})
b.task('dev:client', ['assets'], function() {
_client(true)
})
b.task('server', function() {
_server(false)
})
b.task('dev:server', function() {
_server(true)
})
/*
Full build tasks
*/
b.task('build', ['clean', 'client', 'server'])
b.task('dev:build', ['clean', 'dev:client', 'dev:server'])
b.task('default', ['build'])
// starts a server when CLI argument '-s' is set
b.setServerPort(5555)
b.serve({
static: true, route: '/', folder: 'dist'
})
/*
In dev mode no ES5 transforms are made
*/
function _client(devMode) {
b.css('./app/app.css', 'dist/app.css', { variables: true })
b.js('app/app.js', {
target: {
dest: './dist/app.js',
format: 'umd',
moduleName: 'app'
},
buble: !devMode
})
}
/*
In dev mode no ES5 transforms are made
*/
function _server(devMode) {
b.js('server.js', {
external: ['express', 'ws', 'path', 'http'],
target: {
dest: './server.cjs.js',
format: 'cjs',
moduleName: 'collab-writer'
},
buble: !devMode
})
}