Gruntfile.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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/converter.js',
  19. 'src/subParsers/*.js',
  20. 'src/loader.js'
  21. ],
  22. dest: 'dist/<%= pkg.name %>.js'
  23. },
  24. test: {
  25. src: '<%= concat.dist.dest %>',
  26. dest: '.build/<%= pkg.name %>.js',
  27. options: {
  28. sourceMap: false
  29. }
  30. }
  31. },
  32. clean: ['.build/'],
  33. uglify: {
  34. options: {
  35. sourceMap: true,
  36. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  37. },
  38. dist: {
  39. files: {
  40. 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
  41. }
  42. }
  43. },
  44. jshint: {
  45. options: {
  46. jshintrc: '.jshintrc'
  47. },
  48. files: [
  49. 'Gruntfile.js',
  50. 'src/**/*.js',
  51. 'test/**/*.js'
  52. ]
  53. },
  54. jscs: {
  55. options: {
  56. config: '.jscs.json'
  57. },
  58. files: {
  59. src: [
  60. 'Gruntfile.js',
  61. 'src/**/*.js',
  62. 'test/**/*.js'
  63. ]
  64. }
  65. },
  66. changelog: {
  67. options: {
  68. repository: 'http://github.com/showdownjs/showdown',
  69. dest: 'CHANGELOG.md'
  70. }
  71. },
  72. simplemocha: {
  73. node: {
  74. src: 'test/node/**/*.js',
  75. options: {
  76. globals: ['should'],
  77. timeout: 3000,
  78. ignoreLeaks: false,
  79. reporter: 'spec'
  80. }
  81. },
  82. karlcow: {
  83. src: 'test/node/testsuite.karlcow.js',
  84. options: {
  85. globals: ['should'],
  86. timeout: 3000,
  87. ignoreLeaks: false,
  88. reporter: 'spec'
  89. }
  90. },
  91. issues: {
  92. src: 'test/node/testsuite.issues.js',
  93. options: {
  94. globals: ['should'],
  95. timeout: 3000,
  96. ignoreLeaks: false,
  97. reporter: 'spec'
  98. }
  99. },
  100. standard: {
  101. src: 'test/node/testsuite.standard.js',
  102. options: {
  103. globals: ['should'],
  104. timeout: 3000,
  105. ignoreLeaks: false,
  106. reporter: 'spec'
  107. }
  108. },
  109. features: {
  110. src: 'test/node/testsuite.features.js',
  111. options: {
  112. globals: ['should'],
  113. timeout: 3000,
  114. ignoreLeaks: false,
  115. reporter: 'spec'
  116. }
  117. },
  118. single: {
  119. src: 'test/node/**/*.js',
  120. options: {
  121. globals: ['should'],
  122. timeout: 3000,
  123. ignoreLeaks: false,
  124. reporter: 'spec'
  125. }
  126. }
  127. }
  128. };
  129. grunt.initConfig(config);
  130. require('load-grunt-tasks')(grunt);
  131. grunt.registerTask('single-test', function (grep) {
  132. 'use strict';
  133. grunt.config.merge({
  134. simplemocha: {
  135. single: {
  136. options: {
  137. grep: grep
  138. }
  139. }
  140. }
  141. });
  142. grunt.task.run('simplemocha:node');
  143. });
  144. grunt.registerTask('concatenate', ['concat:dist']);
  145. grunt.registerTask('lint', ['jshint', 'jscs']);
  146. grunt.registerTask('test', ['lint', 'concat:test', 'simplemocha:node', 'clean']);
  147. grunt.registerTask('build', ['test', 'concatenate', 'uglify']);
  148. grunt.registerTask('prep-release', ['build', 'changelog']);
  149. // Default task(s).
  150. grunt.registerTask('default', ['test']);
  151. };