This repository has been archived by the owner on Jul 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Gruntfile.js
119 lines (111 loc) · 3.01 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
115
116
117
118
119
/*
Copyright (c) 2015, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License.
See the accompanying LICENSE file for terms.
*/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['src/*.js'],
options: {
scripturl: true,
camelcase: true,
unused: true,
curly: true,
node: true
}
},
jsdoc : {
dist : {
src: ['README.md', 'src/<%= pkg.name %>.js'],
options: {
destination: 'dist/docs',
template : 'node_modules/ink-docstrap/template'
}
}
},
browserify: {
standalone: {
src: [ 'src/<%= pkg.name %>.js' ],
dest: 'dist/<%= pkg.name %>.js',
options: {
browserifyOptions: {
standalone: 'xssFilters'
}
}
}
},
uglify: {
options: {
banner: '/**\n'
+ ' * <%= pkg.name %> - v<%= pkg.version %>\n'
+ ' * Yahoo! Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n'
+ ' */\n',
compress: {
join_vars: true
},
screwIE8: false // must turn it off, otherwise, \x0B will be converted as \v, which is interpreted as v in IE8 or below
},
buildBrowserified: {
src: 'dist/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.min-browserified.js'
},
buildMin: {
options: {
wrap: 'xssFilters'
},
src: 'src/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.min.js'
},
buildMinWithVersion: {
options: {
wrap: 'xssFilters'
},
src: 'src/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.min.js'
}
},
mocha_istanbul: {
coverage: {
src: 'tests/node-unit-tests.js',
options: {
coverageFolder: 'artifacts/test/coverage',
check: {
lines: 80,
statements: 80
},
timeout: 10000
}
}
},
karma: {
options: {
configFile: 'karma.conf.js'
},
ci: {
},
dev: {
reporters: 'dots',
browsers: ['Chrome']
}
},
clean: {
all: ['artifacts', 'node_modules', 'bower_components']
}
});
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-karma');
var testSet = ['jshint', 'mocha_istanbul'];
if (process.env.TRAVIS && process.env.TRAVIS_NODE_VERSION === '0.12')
testSet.push('dist', 'karma:ci');
grunt.registerTask('test', testSet);
grunt.registerTask('dist', ['browserify', 'uglify'])
grunt.registerTask('docs', ['jsdoc']);
grunt.registerTask('default', ['test', 'dist']);
};