1 | module.exports = function (grunt) {
|
2 | grunt.initConfig({
|
3 | pkgFile: 'package.json',
|
4 | clean: ['build'],
|
5 | babel: {
|
6 | options: {
|
7 | sourceMap: false,
|
8 | plugins: ['transform-object-assign']
|
9 | },
|
10 | dist: {
|
11 | files: [{
|
12 | expand: true,
|
13 | cwd: './lib',
|
14 | src: ['*.js'],
|
15 | dest: 'build',
|
16 | ext: '.js'
|
17 | }]
|
18 | }
|
19 | },
|
20 | mocha_istanbul: {
|
21 | coverage: {
|
22 | src: ['test/*.spec.js'],
|
23 | options: {
|
24 | scriptPath: require.resolve('isparta/bin/isparta'),
|
25 | reporter: 'spec',
|
26 | mochaOptions: ['--compilers', 'js:babel/register', '--recursive'],
|
27 | require: ['should']
|
28 | }
|
29 | }
|
30 | },
|
31 | watch: {
|
32 | dist: {
|
33 | files: ['./lib/*.js'],
|
34 | tasks: ['babel:dist']
|
35 | }
|
36 | },
|
37 | eslint: {
|
38 | options: {
|
39 | parser: 'babel-eslint'
|
40 | },
|
41 | target: ['index.js']
|
42 | },
|
43 | contributors: {
|
44 | options: {
|
45 | commitMessage: 'update contributors'
|
46 | }
|
47 | },
|
48 | bump: {
|
49 | options: {
|
50 | commitMessage: 'v%VERSION%',
|
51 | pushTo: 'upstream'
|
52 | }
|
53 | }
|
54 | })
|
55 |
|
56 | require('load-grunt-tasks')(grunt)
|
57 | grunt.registerTask('default', ['build'])
|
58 | grunt.registerTask('build', 'Build wdio-testingbot-service', function () {
|
59 | grunt.task.run([
|
60 | 'eslint',
|
61 | 'clean',
|
62 | 'babel',
|
63 | 'mocha_istanbul'
|
64 | ])
|
65 | })
|
66 | grunt.registerTask('release', 'Bump and tag version', function (type) {
|
67 | grunt.task.run([
|
68 | 'build',
|
69 | 'contributors',
|
70 | 'bump:' + (type || 'patch')
|
71 | ])
|
72 | })
|
73 | }
|