This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
gruntfile.js
53 lines (50 loc) · 1.66 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
/* jshint node:true */
function config(name) {
return require('./grunt_tasks/' + name + '.js');
}
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: config('jshint'),
watch: {
files: ['ajax-form.js', 'grunt_tasks/*.js', 'test/unit/*'],
tasks: ['jshint', 'karma:dev']
},
copy: {
npmPreRelease: {
files: [
{src: 'README.md', dest: 'dist/'},
{src: 'LICENSE', dest: 'dist/'},
{src: 'ajax-form.html', dest: 'dist/'},
{src: 'ajax-form.js', dest: 'dist/'},
{src: 'package.json', dest: 'dist/'}
]
}
},
shell: {
npmRelease: {
command: [
'cd dist',
'npm publish'
].join('&&')
},
wctLocal: {
command: [
'$(npm bin)/wct --plugin local'
].join('&&')
},
wctSauce: {
command: [
'$(npm bin)/wct --plugin sauce'
].join('&&')
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('default', ['jshint', 'shell:wctLocal']);
grunt.registerTask('travis', ['jshint', 'shell:wctSauce']);
grunt.registerTask('publishToNpm', ['jshint', 'shell:wctLocal', 'copy:npmPreRelease', 'shell:npmRelease']);
};