Gruntfile.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * Created by Tivie on 12-11-2014.
  3. */
  4. module.exports = function (grunt) {
  5. // Project configuration.
  6. var config = {
  7. pkg: grunt.file.readJSON('package.json'),
  8. concat: {
  9. options: {
  10. sourceMap: true,
  11. banner: ';/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n(function(){\n',
  12. footer: '}).call(this)'
  13. },
  14. dist: {
  15. src: [
  16. 'src/showdown.js',
  17. 'src/helpers.js',
  18. 'src/subParsers/*.js',
  19. 'src/loader.js'
  20. ],
  21. dest: 'dist/<%= pkg.name %>.js'
  22. }
  23. },
  24. uglify: {
  25. options: {
  26. sourceMap: true,
  27. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  28. },
  29. dist: {
  30. files: {
  31. 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
  32. }
  33. }
  34. },
  35. jshint: {
  36. files: [
  37. 'Gruntfile.js',
  38. 'src/**/*.js',
  39. 'test/**/*.js'
  40. ]
  41. },
  42. jscs: {
  43. options: {
  44. config: '.jscs.json',
  45. },
  46. files: {
  47. src: [
  48. 'Gruntfile.js',
  49. 'src/**/*.js',
  50. 'test/**/*.js'
  51. ]
  52. }
  53. },
  54. changelog: {
  55. options: {
  56. repository: 'http://github.com/showdownjs/showdown',
  57. dest: 'CHANGELOG.md'
  58. }
  59. },
  60. simplemocha: {
  61. node: {
  62. src: 'test/node/**/*.js',
  63. options: {
  64. globals: ['should'],
  65. timeout: 3000,
  66. ignoreLeaks: false,
  67. reporter: 'spec'
  68. }
  69. },
  70. browser: {
  71. src: 'test/browser/**/*.js',
  72. options: {
  73. reporter: 'spec'
  74. }
  75. }
  76. }
  77. };
  78. grunt.initConfig(config);
  79. grunt.loadNpmTasks('grunt-contrib-concat');
  80. grunt.loadNpmTasks('grunt-contrib-uglify');
  81. grunt.loadNpmTasks('grunt-contrib-jshint');
  82. grunt.loadNpmTasks('grunt-simple-mocha');
  83. grunt.loadNpmTasks('grunt-jscs');
  84. grunt.loadNpmTasks('grunt-conventional-changelog');
  85. grunt.registerTask('lint', ['jshint', 'jscs']);
  86. grunt.registerTask('test', ['lint', 'concat', 'simplemocha']);
  87. grunt.registerTask('test-without-building', ['simplemocha']);
  88. grunt.registerTask('build', ['lint', 'test', 'uglify']);
  89. // Default task(s).
  90. grunt.registerTask('default', []);
  91. };