-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
101 lines (76 loc) · 2.85 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const path = require( 'path' );
const babel = require( 'rollup-plugin-babel' );
const distPath = path.resolve( __dirname, './dist/' );
const nodeResolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
module.exports = function ( grunt ) {
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
bump: {
options: {
files: [ 'package.json', 'bower.json' ],
updateConfigs: [ 'pkg' ],
createTag: true,
push: true,
pushTo: 'origin',
commitFiles: [ '-a' ],
runTasks: [ 'default' ]
}
},
exec: {
npm_publish: 'npm publish'
},
rollup: {
distModule: {
options: {
format: 'cjs',
sourceMap: true,
plugins: [
babel( {
babelrc: false,
plugins: [
'transform-exponentiation-operator',
[ 'inline-replace-variables', {
'__VERSION__': 'v<%= pkg.version %>'
} ]
]
} )
]
},
files: {
'dist/waveform.js': './waveform.js'
}
}
}
} );
var fs = require( 'fs' );
grunt.loadNpmTasks( 'grunt-bump' );
grunt.loadNpmTasks( 'grunt-rollup' );
grunt.loadNpmTasks( 'grunt-exec' );
grunt.registerTask( 'default', [ 'rollup' ] );
grunt.registerTask( 'minify', 'Minifying distribution file', [ 'uglify', 'babel:minify' ] );
grunt.registerTask( 'release', 'Make a new release', function () {
grunt.task.run( 'bump:prerelease:bump-only' );
grunt.task.run( 'default' );
grunt.task.run( 'bump:prerelease:commit-only' );
grunt.task.run( 'exec:npm_publish' );
} );
grunt.registerTask( 'patch', 'Make a new patch', function () {
grunt.task.run( 'bump:patch:bump-only' );
grunt.task.run( 'default' );
grunt.task.run( 'bump:patch:commit-only' );
grunt.task.run( 'exec:npm_publish' );
} );
grunt.registerTask( 'minor', 'Make a minor release', function () {
grunt.task.run( 'bump:minor:bump-only' );
grunt.task.run( 'default' );
grunt.task.run( 'bump:minor:commit-only' );
grunt.task.run( 'exec:npm_publish' );
} );
grunt.registerTask( 'major', 'Make a new release', function () {
grunt.task.run( 'bump:major:bump-only' );
grunt.task.run( 'default' );
grunt.task.run( 'bump:major:commit-only' );
grunt.task.run( 'exec:npm_publish' );
} );
};