This repository has been archived by the owner on Sep 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Gruntfile.js
134 lines (130 loc) · 4.32 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* 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'),
exec: {
cssparser: {
command: './node_modules/jison/lib/cli.js src/css-parser/css-parser.strict.attr.partial.y src/css-parser/css.strict.l --outfile src/css-parser/css-parser.js'
},
},
jshint: {
files: [ 'src/*.js' ],
options: {
scripturl: true,
camelcase: true
}
},
browserify: {
standalone: {
src: 'src/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.js',
options: {
browserifyOptions: {
standalone: 'Handlebars'
}
}
},
},
uglify: {
options: {
banner: ['/**',
' * <%= pkg.name %> - v<%= pkg.version %>',
' * Bundling context-parser and xss-filters',
' * Yahoo! Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.',
' *',
' * Bundling handlebars v3.0.3',
' * Copyright (C) 2011-2014 by Yehuda Katz',
' * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.',
' */', ''].join('\n'),
compress: {
join_vars: true
}
},
buildMin: {
src: ['src/polyfills/*.js', 'dist/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.min.js'
},
buildMinWithVersion: {
src: ['src/polyfills/*.js', 'dist/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.min.js'
}
},
karma: {
integrationtest: {
options: {
configFile: 'karma.conf.js',
files: [
'node_modules/chai/chai.js',
'dist/<%= pkg.name %>.js',
'tests/integration/*.js'
]
}
},
integrationtestUsingMinVersion: {
options: {
configFile: 'karma.conf.js',
files: [
'node_modules/chai/chai.js',
'dist/<%= pkg.name %>.min.js',
'tests/integration/*.js'
]
}
}
},
mocha_istanbul: {
target: {
src: 'tests/unit',
options: {
excludes: [
'src/css-parser/css-parser.js',
'src/polyfills/browser.js',
'src/polyfills/minimal.js'
],
coverage: true,
check: {
lines: 80,
statements: 80
}
}
}
},
bump: {
options: {
files: [ 'package.json', 'bower.json'],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'bower.json', 'dist/.'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
},
clean: {
all: ['artifacts', 'coverage', 'node_modules'],
buildResidues: ['artifacts', 'coverage']
}
});
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('test', ['clean:buildResidues', 'jshint', 'exec', 'dist', 'karma', 'mocha_istanbul']);
grunt.registerTask('dist', ['browserify', 'uglify']);
grunt.registerTask('default', ['test']);
grunt.registerTask('release', ['bump-only', 'dist'])
};