-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
120 lines (109 loc) · 3.74 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
* Created by Aaron on 7/9/2015.
*/
module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-babel' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-banner' );
var LICENSE = '/****\n * ' +
grunt.file.read( './LICENSE', {encoding: 'utf-8'} ).replace( /\n/ig, '\n * ' ) +
'\n ****/';
var loose = {loose: true};
var base_plugins = [
['transform-es2015-arrow-functions', loose],
['transform-es2015-block-scoped-functions', loose],
['transform-es2015-block-scoping', loose],
['transform-es2015-computed-properties', loose],
['transform-es2015-constants', loose],
['transform-es2015-destructuring', loose],
['transform-es2015-for-of', loose],
['transform-es2015-function-name', loose],
['transform-es2015-literals', loose],
['transform-es2015-parameters', loose],
['transform-es2015-shorthand-properties', loose],
['transform-es2015-spread', loose],
['transform-es2015-template-literals', loose],
['transform-es2015-classes', loose],
['transform-undefined-to-void']
];
var async_plugins = [
['transform-async-to-module-method', {module: 'bluebird', method: 'coroutine', loose: true}],
['transform-es2015-modules-commonjs', loose],
['transform-runtime', loose]
];
grunt.initConfig( {
babel: {
options: {
ast: false,
sourceMaps: false,
compact: false
},
build: {
options: {
plugins: base_plugins.concat( [['transform-es2015-modules-commonjs', loose]] )
},
files: [
{
expand: true,
cwd: './src/',
src: './**/*.js',
dest: './build/'
}
]
},
tests: {
options: {
plugins: async_plugins.concat( base_plugins )
},
files: [
{
expand: true,
cwd: './test/src/',
src: './**/*.js',
dest: './test/build/'
}
]
},
benchmark: {
options: {
plugins: async_plugins.concat( base_plugins )
},
files: [
{
expand: true,
cwd: './benchmark/src/',
src: './**/*.js',
dest: './benchmark/build/'
}
]
}
},
usebanner: {
license: {
options: {
position: 'top',
banner: LICENSE,
linebreak: true
},
files: {
src: ['./build/**/*.js']
}
}
},
clean: {
build: {
src: ['./build']
},
tests: {
src: ['./test/build']
},
benchmark: {
src: ['./benchmark/build']
}
}
} );
grunt.registerTask( 'build', ['clean:build', 'babel:build', 'usebanner:license'] );
grunt.registerTask( 'build-tests', ['clean:tests', 'babel:tests'] );
grunt.registerTask( 'build-benchmark', ['clean:benchmark', 'babel:benchmark'] );
grunt.registerTask( 'default', ['build', 'build-benchmark', 'build-tests'] );
};