|
1 | 1 | module.exports = function(grunt) { |
2 | 2 | function getBanner(isDemo) { |
3 | | - return '/*!' + |
4 | | - ' * sqlite-parser' + (isDemo ? ' demo' : '') + |
5 | | - ' * @copyright Code School 2015 {@link http://codeschool.com}' + |
6 | | - ' * @author Nick Wronski <nick@javascript.com>' + |
| 3 | + return '/*!\n' + |
| 4 | + ' * <%= pkg.name %>' + (isDemo ? '-demo' : '') + ' - v<%= pkg.version %>\n' + |
| 5 | + ' * @copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + |
| 6 | + ' * @author Nick Wronski <nick@javascript.com>\n' + |
7 | 7 | ' */'; |
8 | 8 | } |
9 | 9 | grunt.initConfig({ |
| 10 | + pkg: grunt.file.readJSON('package.json'), |
10 | 11 | browserify: { |
11 | 12 | dist: { |
12 | 13 | options: { |
@@ -200,16 +201,27 @@ module.exports = function(grunt) { |
200 | 201 | } |
201 | 202 | } |
202 | 203 | }, |
| 204 | + replace: { |
| 205 | + options: { |
| 206 | + patterns: [ |
| 207 | + { |
| 208 | + match: 'VERSION', |
| 209 | + replacement: '<%= pkg.version %>' |
| 210 | + } |
| 211 | + ] |
| 212 | + }, |
| 213 | + dist: { |
| 214 | + files: [{ |
| 215 | + expand: true, |
| 216 | + cwd: 'dist/', |
| 217 | + src: 'sqlite-parser*.js', |
| 218 | + dest: 'dist/' |
| 219 | + }] |
| 220 | + } |
| 221 | + } |
203 | 222 | }); |
204 | 223 |
|
205 | | - grunt.loadNpmTasks('grunt-shell'); |
206 | | - grunt.loadNpmTasks('grunt-contrib-watch'); |
207 | | - grunt.loadNpmTasks('grunt-contrib-clean'); |
208 | | - grunt.loadNpmTasks('grunt-contrib-copy'); |
209 | | - grunt.loadNpmTasks('grunt-browserify'); |
210 | | - grunt.loadNpmTasks('grunt-contrib-connect'); |
211 | | - grunt.loadNpmTasks('grunt-contrib-uglify'); |
212 | | - grunt.loadNpmTasks('grunt-contrib-cssmin'); |
| 224 | + require('load-grunt-tasks')(grunt); |
213 | 225 |
|
214 | 226 | grunt.registerTask('default', [ |
215 | 227 | 'build' |
@@ -237,7 +249,7 @@ module.exports = function(grunt) { |
237 | 249 | 'interactive', 'clean:demo', 'copy:demo', 'uglify:demo', 'usebanner:demo' |
238 | 250 | ]); |
239 | 251 | grunt.registerTask('dist', [ |
240 | | - 'default', 'clean:dist', 'browserify:dist', 'uglify:dist', 'usebanner:dist' |
| 252 | + 'default', 'clean:dist', 'browserify:dist', 'uglify:dist', 'replace:dist', 'usebanner:dist' |
241 | 253 | ]); |
242 | 254 | grunt.registerTask('release', [ |
243 | 255 | 'test', 'dist', 'demo', 'clean:interactive' |
|
0 commit comments