This repository was archived by the owner on Dec 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
104 lines (89 loc) · 2.26 KB
/
gulpfile.js
File metadata and controls
104 lines (89 loc) · 2.26 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
var path = require('path');
var gulp = require('gulp');
var jeditor = require("gulp-json-editor");
var NwBuilder = require('node-webkit-builder');
var Promise = require('bluebird');
var config = {
dir: {
build: './build',
dist: './dist'
}
}
gulp.task('install-dependencies', function()
{
var tasks = [];
tasks.push(new Promise(function(pass, fail)
{
gulp.src('node_modules/jquery/dist/jquery.min.js')
.pipe(gulp.dest(path.join(config.dir.build, 'js')))
.on('error', fail)
.on('end', pass);
}));
tasks.push(new Promise(function(pass, fail)
{
gulp.src('node_modules/angular/angular.js')
.pipe(gulp.dest(path.join(config.dir.build, 'js')))
.on('error', fail)
.on('end', pass);
}));
tasks.push(new Promise(function(pass, fail)
{
gulp.src('node_modules/irc-protocol/**/*')
.pipe(gulp.dest(path.join(config.dir.build, 'node_modules', 'irc-protocol')))
.on('error', fail)
.on('end', pass);
}));
tasks.push(new Promise(function(pass, fail)
{
gulp.src('node_modules/bluebird/**/*')
.pipe(gulp.dest(path.join(config.dir.build, 'node_modules', 'bluebird')))
.on('error', fail)
.on('end', pass);
}));
return Promise.all(tasks);
});
gulp.task('build', function(cb)
{
var tasks = [];
tasks.push(new Promise(function(pass, fail)
{
gulp.src('app/**/*')
.pipe(gulp.dest(config.dir.build))
.on('error', fail)
.on('end', pass);
}));
tasks.push(new Promise(function(pass, fail)
{
gulp.src('package.json')
.pipe(jeditor({
// Remove dev properties
scripts: undefined,
dependencies: undefined,
devDependencies: undefined,
// Add NW.js properties
main: 'index.html',
window: {
frame: false,
toolbar: true, // Only for debugging, disable for release
width: 1280,
height: 720
}
}))
.pipe(gulp.dest(config.dir.build))
.on('error', fail)
.on('end', pass);
}));
return Promise.all(tasks);
});
gulp.task('package', ['install-dependencies', 'build'], function()
{
var nw = new NwBuilder({
files: path.join(config.dir.build, '**', '**'),
buildDir: config.dir.dist,
platforms: ['win32']
//platforms: ['osx32', 'osx64', 'win32', 'win64']
});
nw.on('log', console.log);
return nw.build();
})
gulp.task('default', ['install-dependencies', 'build', 'package']);