forked from lrsjng/jquery-qrcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.js
112 lines (78 loc) · 2.18 KB
/
makefile.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
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
105
106
107
108
109
110
111
112
/*jshint node: true */
'use strict';
module.exports = function (make) {
var path = require('path'),
pkg = require('./package.json'),
$ = make.fQuery,
root = path.resolve(__dirname),
src = path.join(root, 'src'),
build = path.join(root, 'build');
make.version('>=0.10.0');
make.defaults('release');
make.before(function () {
var moment = make.moment();
make.env = {
pkg: pkg,
stamp: moment.format('YYYY-MM-DD HH:mm:ss')
};
$.info({ method: 'before', message: pkg.version + ' ' + make.env.stamp });
});
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
if (!/\+$/.test(pkg.version)) {
done();
return;
}
$.git(root, function (err, result) {
pkg.version += result.buildSuffix;
$.info({ method: 'check-version', message: 'version set to ' + pkg.version });
done();
});
});
make.target('clean', [], 'delete build folder').sync(function () {
$.DELETE(build);
});
make.target('lint', [], 'lint all JavaScript files with JSHint').sync(function () {
var options = {
// Enforcing Options
bitwise: true,
curly: true,
eqeqeq: true,
forin: true,
latedef: true,
newcap: true,
noempty: true,
plusplus: true,
trailing: true,
undef: true,
// Environments
browser: true
},
global = {
'jQuery': true,
'qrcode': true
};
$(src + ': jquery.qrcode.js, demo/scripts.js').log(-3)
.jshint(options, global);
});
make.target('build', ['check-version'], 'build all updated files').sync(function () {
$(src + ': jquery.qrcode.js')
.includify()
.handlebars(make.env)
.WRITE($.map.p(src, build).s('.js', '-' + pkg.version + '.js'))
.uglifyjs()
.WRITE($.map.p(src, build).s('.js', '-' + pkg.version + '.min.js'));
$(src + ': **, ! *.js')
.handlebars(make.env)
.WRITE($.map.p(src, build));
$(root + ': README*, LICENSE*')
.handlebars(make.env)
.WRITE($.map.p(root, build));
});
make.target('release', ['clean', 'build'], 'create a zipball').async(function (done, fail) {
$(build + ': **').shzip({
target: path.join(build, pkg.name + '-' + pkg.version + '.zip'),
dir: build,
callback: done
});
});
};