Gruntfile.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. },
  25. uglify: {
  26. options: {
  27. sourceMap: true,
  28. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  29. },
  30. dist: {
  31. files: {
  32. 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
  33. }
  34. }
  35. },
  36. jshint: {
  37. files: [
  38. 'Gruntfile.js',
  39. 'src/**/*.js',
  40. 'test/**/*.js'
  41. ]
  42. },
  43. jscs: {
  44. options: {
  45. config: '.jscs.json'
  46. },
  47. files: {
  48. src: [
  49. 'Gruntfile.js',
  50. 'src/**/*.js',
  51. 'test/**/*.js'
  52. ]
  53. }
  54. },
  55. changelog: {
  56. options: {
  57. repository: 'http://github.com/showdownjs/showdown',
  58. dest: 'CHANGELOG.md'
  59. }
  60. },
  61. bump: {
  62. options: {
  63. files: ['package.json'],
  64. updateConfigs: [],
  65. commit: true,
  66. commitMessage: 'Release version %VERSION%',
  67. commitFiles: ['package.json'],
  68. createTag: true,
  69. tagName: '%VERSION%',
  70. tagMessage: 'Version %VERSION%',
  71. push: true,
  72. pushTo: 'upstream',
  73. gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
  74. globalReplace: false,
  75. prereleaseName: 'alpha',
  76. regExp: false
  77. }
  78. },
  79. simplemocha: {
  80. node: {
  81. src: 'test/node/**/*.js',
  82. options: {
  83. globals: ['should'],
  84. timeout: 3000,
  85. ignoreLeaks: false,
  86. reporter: 'spec'
  87. }
  88. },
  89. karlcow: {
  90. src: 'test/node/testsuite.karlcow.js',
  91. options: {
  92. globals: ['should'],
  93. timeout: 3000,
  94. ignoreLeaks: false,
  95. reporter: 'spec'
  96. }
  97. },
  98. browser: {
  99. src: 'test/browser/**/*.js',
  100. options: {
  101. reporter: 'spec'
  102. }
  103. }
  104. }
  105. };
  106. grunt.initConfig(config);
  107. require('load-grunt-tasks')(grunt);
  108. grunt.registerTask('concatenate', ['concat']);
  109. grunt.registerTask('lint', ['jshint', 'jscs']);
  110. grunt.registerTask('test', ['lint', 'concat', 'simplemocha:node']);
  111. grunt.registerTask('test-without-building', ['simplemocha:node']);
  112. grunt.registerTask('build', ['test', 'uglify']);
  113. grunt.registerTask('prep-release', ['build', 'changelog']);
  114. // Default task(s).
  115. grunt.registerTask('default', ['test']);
  116. };