Gruntfile.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. 'use strict';
  2. module.exports = function(grunt) {
  3. // Project configuration.
  4. grunt.initConfig({
  5. // Metadata.
  6. pkg: grunt.file.readJSON("package.json"),
  7. // Task configuration.
  8. concat: {
  9. options: {
  10. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  11. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  12. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  13. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  14. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n'
  15. },
  16. dist: {
  17. src: ['src/jquery.ajaxQueue.js'],
  18. dest: 'dist/jquery.ajaxQueue.js'
  19. },
  20. },
  21. uglify: {
  22. options: {
  23. banner: "/*! jQuery Ajax Queue v<%= pkg.version %> | (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %> | Licensed <%= _.pluck(pkg.licenses, \"type\").join(\", \") %> */\n",
  24. sourceMap: "dist/jquery.ajaxQueue.min.map",
  25. beautify: {
  26. ascii_only: true
  27. }
  28. },
  29. all: {
  30. files: {
  31. "dist/jquery.ajaxQueue.min.js": ['src/jquery.ajaxQueue.js']
  32. }
  33. },
  34. },
  35. qunit: {
  36. files: ['test/**/*.html']
  37. },
  38. jshint: {
  39. gruntfile: {
  40. options: {
  41. jshintrc: '.jshintrc'
  42. },
  43. src: ['Gruntfile.js']
  44. },
  45. src: {
  46. options: {
  47. jshintrc: 'src/.jshintrc'
  48. },
  49. src: ['src/**/*.js']
  50. },
  51. test: {
  52. options: {
  53. jshintrc: 'test/.jshintrc'
  54. },
  55. src: ['test/**/*.js']
  56. },
  57. },
  58. watch: {
  59. gruntfile: {
  60. files: '<config:jshint.gruntfile.src>',
  61. tasks: ['jshint:gruntfile']
  62. },
  63. src: {
  64. files: '<config:jshint.src.src>',
  65. tasks: ['jshint:src', 'qunit']
  66. },
  67. test: {
  68. files: '<config:jshint.test.src>',
  69. tasks: ['jshint:test', 'qunit']
  70. },
  71. },
  72. });
  73. // Default task.
  74. grunt.loadNpmTasks("grunt-contrib-concat");
  75. grunt.loadNpmTasks("grunt-contrib-watch");
  76. grunt.loadNpmTasks("grunt-contrib-jshint");
  77. grunt.loadNpmTasks("grunt-contrib-uglify");
  78. grunt.loadNpmTasks("grunt-contrib-qunit");
  79. grunt.registerTask('default', ['jshint', 'concat', 'qunit', 'manifest', 'concat', 'uglify']);
  80. grunt.registerTask( "manifest", function() {
  81. var pkg = grunt.config( "pkg" );
  82. grunt.file.write( "ajaxQueue.jquery.json", JSON.stringify({
  83. name: "ajaxQueue",
  84. title: pkg.title,
  85. description: pkg.description,
  86. keywords: pkg.keywords,
  87. version: pkg.version,
  88. author: {
  89. name: pkg.author.name,
  90. url: pkg.author.url.replace( "master", pkg.version )
  91. },
  92. maintainers: pkg.maintainers,
  93. licenses: pkg.licenses.map(function( license ) {
  94. license.url = license.url.replace( "master", pkg.version );
  95. return license;
  96. }),
  97. bugs: pkg.bugs,
  98. homepage: pkg.homepage,
  99. docs: pkg.homepage,
  100. dependencies: {
  101. jquery: ">=1.5"
  102. }
  103. }, null, "\t" ) );
  104. });
  105. };