Gruntfile.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. var fs = require('fs'),
  2. path = require('path'),
  3. semver = require('semver')
  4. module.exports = function( grunt ) {
  5. grunt.initConfig({
  6. pkg: grunt.file.readJSON('package.json'),
  7. componentbuild: {
  8. build: {
  9. options: {
  10. name: 'vue',
  11. standalone: 'Vue'
  12. },
  13. src: '.',
  14. dest: 'dist'
  15. },
  16. test: {
  17. options: {
  18. name: 'vue.test'
  19. },
  20. src: '.',
  21. dest: 'test'
  22. }
  23. },
  24. jshint: {
  25. options: {
  26. reporter: require('jshint-stylish'),
  27. jshintrc: true
  28. },
  29. dev: {
  30. src: ['src/**/*.js']
  31. },
  32. test: {
  33. src: ['test/unit/specs/*.js', 'test/functional/specs/*.js']
  34. }
  35. },
  36. mocha: {
  37. test: {
  38. src: ['test/unit/runner.html'],
  39. options: {
  40. log: true,
  41. run: true
  42. }
  43. }
  44. },
  45. uglify: {
  46. build: {
  47. options: {
  48. compress: true,
  49. mangle: true,
  50. banner:
  51. '/*\n' +
  52. ' VueJS v<%= version %>\n' +
  53. ' (c) 2013 Evan You\n' +
  54. ' License: MIT\n' +
  55. '*/\n'
  56. },
  57. files: {
  58. 'dist/vue.min.js': 'dist/vue.js'
  59. }
  60. }
  61. },
  62. watch: {
  63. dev: {
  64. files: ['src/**/*.js', 'component.json'],
  65. tasks: ['componentbuild', 'jsc']
  66. }
  67. }
  68. })
  69. grunt.loadNpmTasks( 'grunt-contrib-watch' )
  70. grunt.loadNpmTasks( 'grunt-contrib-jshint' )
  71. grunt.loadNpmTasks( 'grunt-contrib-uglify' )
  72. grunt.loadNpmTasks( 'grunt-component-build' )
  73. grunt.loadNpmTasks( 'grunt-mocha' )
  74. grunt.file.recurse('tasks', function (path) {
  75. require('./' + path)(grunt)
  76. })
  77. grunt.registerTask( 'test', [
  78. 'componentbuild',
  79. 'jsc',
  80. 'mocha',
  81. 'casper'
  82. ])
  83. grunt.registerTask( 'default', [
  84. 'jshint',
  85. 'test'
  86. ])
  87. }