gruntfile.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. module.exports = function (grunt) {
  2. grunt.initConfig({
  3. pkgFile: 'package.json',
  4. simplemocha: {
  5. options: {
  6. ui: 'bdd',
  7. reporter: 'dot'
  8. },
  9. unit: {
  10. src: [
  11. 'test/mocha-globals.js',
  12. 'test/*.spec.js'
  13. ]
  14. }
  15. },
  16. 'npm-contributors': {
  17. options: {
  18. commitMessage: 'chore: update contributors'
  19. }
  20. },
  21. conventionalChangelog: {
  22. release: {
  23. options: {
  24. changelogOpts: {
  25. preset: 'angular'
  26. }
  27. },
  28. src: 'CHANGELOG.md'
  29. }
  30. },
  31. conventionalGithubReleaser: {
  32. release: {
  33. options: {
  34. auth: {
  35. type: 'oauth',
  36. token: process.env.GH_TOKEN
  37. },
  38. changelogOpts: {
  39. preset: 'angular',
  40. releaseCount: 0
  41. }
  42. }
  43. }
  44. },
  45. bump: {
  46. options: {
  47. commitMessage: 'chore: release v%VERSION%',
  48. pushTo: 'upstream',
  49. commitFiles: [
  50. 'package.json',
  51. 'CHANGELOG.md'
  52. ]
  53. }
  54. },
  55. karma: {
  56. options: {
  57. singleRun: true
  58. },
  59. simple: {
  60. configFile: 'examples/simple/karma.conf.js'
  61. }
  62. }
  63. })
  64. require('load-grunt-tasks')(grunt)
  65. grunt.registerTask('test', ['simplemocha'])
  66. grunt.registerTask('default', ['test'])
  67. grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
  68. grunt.task.run([
  69. 'npm-contributors',
  70. 'bump:' + (type || 'patch') + ':bump-only',
  71. 'conventionalChangelog',
  72. 'bump-commit',
  73. 'conventionalGithubReleaser',
  74. 'npm-publish'
  75. ])
  76. })
  77. }