Gruntfile.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*global module:false*/
  2. module.exports = function (grunt) {
  3. // Project configuration.
  4. grunt.initConfig({
  5. // Metadata.
  6. pkg: grunt.file.readJSON('package.json'),
  7. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  8. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  9. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  10. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  11. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  12. // Task configuration.
  13. concat: {
  14. options: {
  15. banner: '<%= banner %>',
  16. stripBanners: true
  17. },
  18. dist: {
  19. src: [ 'lib/es5.js', 'lib/proto.js'],
  20. dest: 'dist/proto.js'
  21. },
  22. es5: {
  23. src: ['lib/proto.js'],
  24. dest: 'dist/proto.es5.js'
  25. }
  26. },
  27. uglify: {
  28. options: {
  29. banner: '<%= banner %>'
  30. },
  31. dist: {
  32. src: '<%= concat.dist.dest %>',
  33. dest: 'dist/proto.min.js'
  34. },
  35. legacy: {
  36. src: '<%= concat.dist.dest %>',
  37. dest: 'proto.min.js'
  38. },
  39. es5: {
  40. src: '<%= concat.es5.dest %>',
  41. dest: 'dist/proto.es5.min.js'
  42. }
  43. },
  44. jshint: {
  45. options: {
  46. jshintrc: '.jshintrc'
  47. },
  48. lib: {
  49. src: ['Gruntfile.js', 'lib/**/*.js', 'test/test.js']
  50. }
  51. },
  52. simplemocha: {
  53. lib: ['test/test.js']
  54. },
  55. release: {}
  56. });
  57. // These plugins provide necessary tasks.
  58. grunt.loadNpmTasks('grunt-contrib-concat');
  59. grunt.loadNpmTasks('grunt-contrib-uglify');
  60. grunt.loadNpmTasks('grunt-contrib-jshint');
  61. grunt.loadNpmTasks('grunt-simple-mocha');
  62. grunt.loadNpmTasks('grunt-release');
  63. // Default task.
  64. grunt.registerTask('test', ['jshint', 'simplemocha']);
  65. grunt.registerTask('default', ['test', 'concat', 'uglify']);
  66. };