Gruntfile.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. bump: {
  61. options: {
  62. files: ['package.json'],
  63. updateConfigs: [],
  64. commit: true,
  65. commitMessage: 'Release version %VERSION%',
  66. commitFiles: ['package.json'],
  67. createTag: true,
  68. tagName: '%VERSION%',
  69. tagMessage: 'Version %VERSION%',
  70. push: true,
  71. pushTo: 'upstream',
  72. gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
  73. globalReplace: false,
  74. prereleaseName: 'alpha',
  75. regExp: false
  76. }
  77. },
  78. simplemocha: {
  79. node: {
  80. src: 'test/node/**/*.js',
  81. options: {
  82. globals: ['should'],
  83. timeout: 3000,
  84. ignoreLeaks: false,
  85. reporter: 'spec'
  86. }
  87. },
  88. browser: {
  89. src: 'test/browser/**/*.js',
  90. options: {
  91. reporter: 'spec'
  92. }
  93. }
  94. }
  95. };
  96. grunt.initConfig(config);
  97. require('load-grunt-tasks')(grunt);
  98. grunt.registerTask('lint', ['jshint', 'jscs']);
  99. grunt.registerTask('test', ['lint', 'concat', 'simplemocha']);
  100. grunt.registerTask('test-without-building', ['simplemocha']);
  101. grunt.registerTask('build', ['lint', 'test', 'uglify']);
  102. grunt.registerTask('prep-release', ['build', 'changelog']);
  103. // Default task(s).
  104. grunt.registerTask('default', ['test']);
  105. };