-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGruntfile.js
More file actions
100 lines (90 loc) · 2.61 KB
/
Gruntfile.js
File metadata and controls
100 lines (90 loc) · 2.61 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
module.exports = function(grunt) {
var bannerContent = '/*! <%= pkg.name %> v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> \n' +
' * License: <%= pkg.license %> */\n',
name = '<%= pkg.name %>-v<%= pkg.version%>',
latest = '<%= pkg.name %>',
devRelease = 'distrib/'+name+'.js',
minRelease = 'distrib/'+name+'.min.js',
sourceMapMin = 'distrib/'+name+'.min.js',
sourceMapUrl = name+'.min.js',
latestDevRelease = 'distrib/'+latest+'.js',
latestMinRelease = 'distrib/'+latest+'.min.js',
latestSourceMapMin = 'distrib/'+latest+'.min.js.map';
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
// concat configuration
concat: {
options: {
banner: bannerContent
},
target : {
src : ['src/**/*.js'],
dest : 'distrib/' + name + '.js'
}
},
// JShint config
jshint: {
options: {
eqeqeq: true,
trailing: true
},
target: {
src : ['src/**/*.js', 'test/**/*.js']
}
},
// Uglify config
uglify: {
options: {
banner: bannerContent,
sourceMapRoot: '../',
sourceMap: 'distrib/'+name+'.min.js.map',
sourceMapUrl: name+'.min.js.map'
},
target : {
src : ['src/**/*.js'],
dest : 'distrib/' + name + '.min.js'
}
},
// Copy config
copy: {
development: { // copy non-minified release file
src: devRelease,
dest: latestDevRelease
},
minified: { // copy minified release file
src: minRelease,
dest: latestMinRelease
},
smMinified: { // source map of minified release file
src: sourceMapMin,
dest: latestSourceMapMin
}
},
bump: {
options: {
files: ['package.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
metadata: '',
regExp: false
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'copy']);
};