-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.coffee
100 lines (86 loc) · 2.34 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
gulp = require 'gulp'
merge = require 'merge-stream'
$ = (require 'gulp-load-plugins')()
packager = require 'electron-packager'
mainBowerFiles = require 'main-bower-files'
pkg = require './package.json'
app_name = pkg.name
include_plugin = ['node_modules/with-schema-editor-schema-with-schema-editor-config/**/*', 'node_modules/with-schema-editor-schema-package.json/**/*', 'node_modules/js-yaml/**/*']
files =
html: 'src/**/*.html'
jade: 'src/**/*.jade'
js: 'src/**/*.js'
coffee: 'src/**/*.coffee'
css: 'src/**/*.css'
stylus: 'src/**/*.styl'
json: 'src/**/*.json'
yaml: 'src/**/*.yaml'
gulp.task 'html', ->
merge [
gulp.src files.html
.pipe gulp.dest 'dst'
gulp.src files.jade
.pipe $.jade()
.pipe gulp.dest 'dst'
]
gulp.task 'js', ->
merge [
gulp.src files.js
.pipe gulp.dest 'dst'
gulp.src files.coffee
.pipe $.coffee()
.pipe gulp.dest 'dst'
]
gulp.task 'css', ->
merge [
gulp.src files.css
.pipe gulp.dest 'dst'
gulp.src files.stylus
.pipe $.stylus()
.pipe gulp.dest 'dst'
]
gulp.task 'json', ->
merge [
gulp.src files.json
.pipe gulp.dest 'dst'
gulp.src files.yaml
.pipe $.yaml()
.pipe gulp.dest 'dst'
]
gulp.task 'package', ->
gulp.src 'package.json'
.pipe gulp.dest 'dst'
gulp.task 'node_modules', ->
gulp.src $.npmFiles(), base: '.'
.pipe gulp.dest 'dst'
gulp.task 'bower_components', ->
gulp.src mainBowerFiles(), base: "./bower_components"
.pipe gulp.dest 'dst/lib'
gulp.task 'b', ['html', 'js', 'css', 'json', 'package', 'node_modules', 'bower_components']
gulp.task 'w', ->
gulp.start ['b']
$.watch [files.html, files.jade], -> gulp.start ['html']
$.watch [files.js, files.coffee], -> gulp.start ['js']
$.watch [files.css, files.stylus], -> gulp.start ['css']
$.watch [files.json, files.yaml], -> gulp.start ['json']
pack = (platform) ->
new Promise (resolve, reject) ->
packager
dir: 'dst'
out: "release"
name: app_name
arch: 'x64'
platform: platform
version: '0.34.2'
overwrite: true
, (error, path) ->
if error?
reject error
else
resolve gulp.src(include_plugin, base: '.').pipe(gulp.dest path[0])
gulp.task 'pw', ['b'], ->
pack 'win32'
gulp.task 'pm', ['b'], ->
pack 'darwin'
gulp.task 'pl', ['b'], ->
pack 'linux'