forked from aeminem/chrome-dribbblehd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
68 lines (58 loc) · 1.51 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
/*global module */
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
manifest: grunt.file.readJSON('extension/manifest.json'),
// JSHint the code.
jshint: {
options: {
jshintrc: '.jshintrc',
},
all: ['extension/js/*.js'],
},
// Clean folders.
clean: {
build: ['build/**', '!build']
},
// Bump up the version in JSON file.
bumpup: 'extension/manifest.json',
// Commit last changes and tag the commit with a version from this JSON file.
tagrelease: 'extension/manifest.json',
// Build an archive ready to be uploaded to web store.
compress: {
main: {
options: {
mode: 'zip',
level: 1,
archive: 'build/<%= pkg.name %>-<%= manifest.version %>.zip'
},
expand: true,
cwd: 'extension/',
src: ['**'],
dest: '/'
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-tagrelease');
grunt.loadNpmTasks('grunt-bumpup');
// Build task.
grunt.registerTask('build', function () {
grunt.task.run('clean');
grunt.task.run('compress');
});
// Release task.
grunt.registerTask('release', function (type) {
type = type ? type : 'patch';
grunt.task.run('jshint');
grunt.task.run('bumpup:' + type);
grunt.task.run('tagrelease');
});
// By default, lint.
grunt.registerTask('default', ['jshint']);
};