UNPKG

1.82 kBJavaScriptView Raw
1module.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 eslint: {
64 target: [
65 'index.js',
66 'gruntfile.js',
67 'test/*.js',
68 'examples/**/*.js'
69 ]
70 }
71 })
72
73 require('load-grunt-tasks')(grunt)
74
75 grunt.registerTask('test', ['simplemocha'])
76 grunt.registerTask('default', ['eslint', 'test'])
77
78 grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
79 grunt.task.run([
80 'npm-contributors',
81 'bump:' + (type || 'patch') + ':bump-only',
82 'conventionalChangelog',
83 'bump-commit',
84 'conventionalGithubReleaser',
85 'npm-publish'
86 ])
87 })
88}