-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
94 lines (86 loc) · 1.96 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
82
83
84
85
86
87
88
89
90
91
92
93
94
module.exports = function(grunt) {
'use strict';
/**
* Load tasks.
*/
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
version: '<%= pkg.version %>',
// Check JavaScript for errors.
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'assets/js/main.js'
]
},
/**
* Watch sources files and compile when they're changed.
*/
watch: {
js: {
files: ['<%= jshint.all %>'],
tasks: ['jshint']
}
},
/**
* Archive the theme in the /release directory, excluding development
* and build related files.
*
* The zip archive will be named: theme-{{version}}.zip
*/
compress: {
dist: {
options: {
archive: 'release/<%= pkg.slug %>-<%= version %>.zip'
},
files: [
{
src: [
'**',
'!node_modules/**',
'!release/**',
'!.jshintrc',
'!Gruntfile.js',
'!package.json'
],
dest: '<%= pkg.slug %>/'
}
]
}
}
});
/**
* Register default task.
*/
grunt.registerTask('default', [
'jshint',
'watch'
]);
/**
* Build a release.
*
* Defaults to the version set in package.json, but a specific version number can be passed
* as the first argument. Ex: grunt release:1.2.3
*
* The project is then zipped into an archive in the release directory,
* excluding unncessary source files in the process.
*
* @todo generate pot files
* bump/verify version numbers
* git tag, commit, and push
* zip to release directory, cleaning source files in the process
* push to remote server
*/
grunt.registerTask('release', function(arg1) {
var pkg = grunt.file.readJSON('package.json');
grunt.config.set('version', 0 === arguments.length ? pkg.version : arg1);
grunt.task.run('jshint');
grunt.task.run('compress:dist');
});
};