1 | module.exports = function (grunt) {
|
2 | grunt.initConfig({
|
3 | pkgFile: 'package.json',
|
4 | files: {
|
5 | adapter: [
|
6 | 'src/adapter.js'
|
7 | ]
|
8 | },
|
9 | build: {
|
10 | adapter: '<%= files.adapter %>'
|
11 | },
|
12 | eslint: {
|
13 | target: [
|
14 | '<%= files.adapter %>',
|
15 | 'gruntfile.js',
|
16 | 'tasks/*.js',
|
17 | 'test/**/*.js'
|
18 | ]
|
19 | },
|
20 | karma: {
|
21 | adapter: {
|
22 | configFile: 'karma.conf.js',
|
23 | autoWatch: false,
|
24 | singleRun: true,
|
25 | reporters: ['dots']
|
26 | }
|
27 | },
|
28 | 'npm-publish': {
|
29 | options: {
|
30 | requires: ['build']
|
31 | }
|
32 | },
|
33 | 'npm-contributors': {
|
34 | options: {
|
35 | commitMessage: 'chore: update contributors'
|
36 | }
|
37 | },
|
38 | bump: {
|
39 | options: {
|
40 | commitMessage: 'chore: release v%VERSION%',
|
41 | pushTo: 'upstream'
|
42 | }
|
43 | }
|
44 | })
|
45 |
|
46 | require('load-grunt-tasks')(grunt)
|
47 | grunt.loadTasks('tasks')
|
48 | grunt.registerTask('default', ['build', 'eslint', 'test'])
|
49 | grunt.registerTask('test', ['karma'])
|
50 |
|
51 | grunt.registerTask('release', 'Build, bump and publish to NPM.', function (type) {
|
52 | grunt.task.run([
|
53 | 'build',
|
54 | 'npm-contributors',
|
55 | 'bump:' + (type || 'patch'),
|
56 | 'npm-publish'
|
57 | ])
|
58 | })
|
59 | }
|