-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
71 lines (63 loc) · 2.03 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
module.exports = function (grunt) {
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
banner:'/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; \n*/\n',
concat: {
options: {
separator: ';'
},
dist: {
src: ['public/js/backbone-command/**/*.js'],
dest: '<%= pkg.name %>.js'
}
},
uglify: {
dist: {
files: {
'<%= pkg.name %>.min.js': '<%= pkg.name %>.js'
},
options: {
banner:'<%= banner %>'
}
}
},
copy: {
backboneCommand: {
src: ['<%= pkg.name %>.js', '<%= pkg.name %>.min.js'],
dest: 'public/js/dist/'
}
},
watch: {
files: ['public/js/*.js'],
tasks: ['concat:dist','uglify:dist', 'copy:backboneCommand']
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: ["pkg","banner"],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'bower.json', '<%= pkg.name %>.min.js', '<%= pkg.name %>.js', 'public/js/dist/<%= pkg.name %>.min.js', 'public/js/dist/<%= pkg.name %>.js'], // '-a' for all files
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin master',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', ['concat','uglify', 'copy']);
grunt.registerTask('release', ['default','bump-commit']);
grunt.registerTask('release:patch', ['bump-only:patch','release']);
grunt.registerTask('release:minor', ['bump-only:minor','release']);
grunt.registerTask('release:major', ['bump-only:major','release']);
};