-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
114 lines (97 loc) · 2.62 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* (C) Copyright 2016 Kurento (http://kurento.org/)
*
* All rights reserved.
*
*/
module.exports = function (grunt) {
var DIST_DIR = 'dist';
var pkg = grunt.file.readJSON('package.json');
var bower = {
TOKEN: process.env.TOKEN,
repository: 'git://github.com/Kurento/<%= pkg.name %>-bower.git'
};
// Project configuration.
grunt.initConfig({
pkg: pkg,
bower: bower,
// Plugins configuration
clean: {
generated_code: DIST_DIR,
generated_doc: '<%= jsdoc.all.dest %>'
},
jshint: {
all: ['lib/**/*.js', "test/*.js"],
options: {
"curly": true,
"indent": 2,
"unused": true,
"undef": true,
"camelcase": false,
"newcap": true,
"node": true,
"browser": true
}
},
// Generate browser versions
browserify: {
options: {
transform: ['browserify-optional']
},
require: {
src: 'lib/browser.js',
dest: DIST_DIR + '/<%= pkg.name %>_require.js'
},
standalone: {
src: 'lib/browser.js',
dest: DIST_DIR + '/<%= pkg.name %>.js',
options: {
browserifyOptions: {
standalone: '<%= pkg.name %>'
}
}
},
// Generate bower.json file from package.json data
sync: {
bower: {
options: {
sync: [
'name', 'description', 'license', 'keywords', 'homepage',
'repository'
],
overrides: {
authors: (pkg.author ? [pkg.author] : []).concat(pkg.contributors || []),
main: ['js/<%= pkg.name %>.js']
}
}
}
},
// Publish / update package info in Bower
shell: {
bower: {
command: [
'curl -X DELETE "https://bower.herokuapp.com/packages/<%= pkg.name %>?auth_token=<%= bower.TOKEN %>"',
'node_modules/.bin/bower register <%= pkg.name %> <%= bower.repository %>',
'node_modules/.bin/bower cache clean'
].join('&&')
}
}
});
// Load plugins
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-githooks');
grunt.loadNpmTasks('grunt-jscoverage');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-npm2bower-sync');
grunt.loadNpmTasks('grunt-shell');
// Alias tasks
grunt.registerTask('default',
['clean', 'jsdoc', 'browserify']
);
grunt.registerTask('bower', ['sync:bower', 'shell:bower']);
grunt.registerTask('coverage', ['clean:coverage', 'jscoverage',
'browserify:coverage'
]);
};