-
Notifications
You must be signed in to change notification settings - Fork 6
/
gruntfile.js
81 lines (74 loc) · 2.44 KB
/
gruntfile.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
/*global module:false*/
module.exports = function(grunt) {
var SPACE_NAME = 'ResizeSensor';
var EXT_JS = '.js';
var EXT_JS_MIN = '.min' + EXT_JS;
var FILE_NAME_OUT_MAX = SPACE_NAME + EXT_JS;
var FILE_NAME_OUT_MIN = SPACE_NAME + EXT_JS_MIN;
var FILE_NAME_ENTRY = SPACE_NAME;
grunt.loadNpmTasks("grunt-contrib-requirejs");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-bumpup");
grunt.loadNpmTasks("grunt-tagrelease");
grunt.loadNpmTasks("grunt-umd");
grunt.config.init({
requirejs : {
dist : {
options : {
name: FILE_NAME_ENTRY,
out: FILE_NAME_OUT_MAX,
baseUrl: 'src',
optimize: 'none',
pragmas: {
release: true
},
skipModuleInsertion: true,
onBuildWrite: function(name, path, contents) {
return require('amdclean').clean({
code: contents.replace(/\/\/>>excludeStart[^]*?\/\/>>excludeEnd\("release"\);/gm, ''),
prefixMode: 'camelCase',
escodegen: {
format: {
indent: { style: ' ' }
}
}
});
}
}
}
},
umd: {
dist: {
src: FILE_NAME_OUT_MAX,
objectToExport: SPACE_NAME,
globalAlias: SPACE_NAME,
dest: FILE_NAME_OUT_MAX
}
},
uglify : {
dist : {
src : [ FILE_NAME_OUT_MAX ],
dest : FILE_NAME_OUT_MIN
}
},
bumpup: {
files: ['package.json', 'bower.json']
},
tagrelease: {
file: 'package.json',
commit: true,
message: 'Release %version%',
prefix: '',
annotate: false
}
});
grunt.registerTask("dist", "requirejs:dist umd:dist uglify".split(' '));
grunt.registerTask("default", "dist".split(' '));
grunt.registerTask("release", function (type) {
grunt.task.run('dist');
if (type != null && type != false){
grunt.task.run('bumpup:' + type);
grunt.task.run('tagrelease');
}
});
};