-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.coffee
58 lines (51 loc) · 1.38 KB
/
gulpfile.coffee
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
gulp = require('gulp')
sequence = require('run-sequence')
exec = require('child_process').exec
env =
dev: true
main: 'http://repo:8080/build/main.js'
vendor: 'http://repo:8080/build/vendor.js'
gulp.task 'rsync', (cb) ->
wrapper = require('rsyncwrapper')
wrapper.rsync {
ssh: true
src: [
'index.html'
'build'
]
recursive: true
args: [ '--verbose' ]
dest: 'talk-ui:/teambition/server/talk-ui/actions-recorder'
deleteAll: true
}, (error, stdout, stderr, cmd) ->
if error != null
throw error
console.error stderr
console.log cmd
cb()
gulp.task 'script', ->
coffee = require('gulp-coffee')
gulp.src('src/**/*.coffee')
.pipe coffee(bare: true)
.pipe gulp.dest('lib/')
gulp.task 'html', (cb) ->
html = require('./template')
fs = require('fs')
assets = undefined
if !env.dev
assets = require('./build/assets.json')
env.main = './build/' + assets.main
env.vendor = './build/' + assets.vendor
fs.writeFile 'index.html', html(env), cb
gulp.task 'del', (cb) ->
del = require('del')
del [ 'build' ], cb
gulp.task 'webpack', (cb) ->
command = if env.dev then 'webpack' else 'webpack --config webpack.min.coffee --progress'
exec command, (err, stdout, stderr) ->
console.log stdout
console.log stderr
cb err
gulp.task 'build', (cb) ->
env.dev = false
sequence 'del', 'webpack', 'html', cb