forked from zry656565/reactable
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
134 lines (124 loc) · 5.72 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
121
122
123
124
125
126
127
128
129
130
131
132
133
var markdownlint = require('markdownlint');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.registerMultiTask('markdownlint', function task() {
var done = this.async();
markdownlint(
{ "files": this.filesSrc },
function callback(err, result) {
var resultString = err || ((result || '').toString());
if (resultString) {
grunt.fail.warn('\n' + resultString + '\n');
}
done(!err || !resultString);
});
});
grunt.initConfig({
watch: {
build: {
files: ['src/**/*.jsx'],
tasks: ['build']
},
test: {
files: ['src/**/*.jsx', 'tests/*.jsx'],
tasks: ['testOnce']
}
},
babel: {
options: { sourceRoot: 'src' },
umd: {
files: {
'tmp/reactable/lib/to_array.js': 'src/reactable/lib/to_array.jsx',
'tmp/reactable/lib/filter_props_from.js': 'src/reactable/lib/filter_props_from.jsx',
'tmp/reactable/lib/extract_data_from.js': 'src/reactable/lib/extract_data_from.jsx',
'tmp/reactable/lib/is_react_component.js': 'src/reactable/lib/is_react_component.jsx',
'tmp/reactable/lib/stringable.js': 'src/reactable/lib/stringable.jsx',
'tmp/reactable/filterer.js': 'src/reactable/filterer.jsx',
'tmp/reactable/sort.js': 'src/reactable/sort.jsx',
'tmp/reactable/td.js': 'src/reactable/td.jsx',
'tmp/reactable/tr.js': 'src/reactable/tr.jsx',
'tmp/reactable/thead.js': 'src/reactable/thead.jsx',
'tmp/reactable/tfoot.js': 'src/reactable/tfoot.jsx',
'tmp/reactable/unsafe.js': 'src/reactable/unsafe.jsx',
'tmp/reactable/th.js': 'src/reactable/th.jsx',
'tmp/reactable/paginator.js': 'src/reactable/paginator.jsx',
'tmp/reactable/table.js': 'src/reactable/table.jsx',
'tmp/reactable.js': 'src/reactable.jsx',
'build/tests/reactable_test.js': 'tests/reactable_test.jsx'
},
options: { modules: 'umdStrict' }
},
common: {
files: {
'lib/reactable/lib/to_array.js': 'src/reactable/lib/to_array.jsx',
'lib/reactable/lib/filter_props_from.js': 'src/reactable/lib/filter_props_from.jsx',
'lib/reactable/lib/extract_data_from.js': 'src/reactable/lib/extract_data_from.jsx',
'lib/reactable/lib/is_react_component.js': 'src/reactable/lib/is_react_component.jsx',
'lib/reactable/lib/stringable.js': 'src/reactable/lib/stringable.jsx',
'lib/reactable/filterer.js': 'src/reactable/filterer.jsx',
'lib/reactable/sort.js': 'src/reactable/sort.jsx',
'lib/reactable/td.js': 'src/reactable/td.jsx',
'lib/reactable/tr.js': 'src/reactable/tr.jsx',
'lib/reactable/thead.js': 'src/reactable/thead.jsx',
'lib/reactable/tfoot.js': 'src/reactable/tfoot.jsx',
'lib/reactable/unsafe.js': 'src/reactable/unsafe.jsx',
'lib/reactable/th.js': 'src/reactable/th.jsx',
'lib/reactable/paginator.js': 'src/reactable/paginator.jsx',
'lib/reactable/table.js': 'src/reactable/table.jsx',
'lib/reactable.js': 'src/reactable.jsx',
'build/tests/reactable_test.js': 'tests/reactable_test.jsx'
},
options: { modules: 'common' }
}
},
concat: {
dist: {
src: [
'tmp/reactable/lib/filter_props_from.js',
'tmp/reactable/lib/to_array.js',
'tmp/reactable/lib/stringable.js',
'tmp/reactable/lib/extract_data_from.js',
'tmp/reactable/lib/is_react_component.js',
'tmp/reactable/unsafe.js',
'tmp/reactable/filterer.js',
'tmp/reactable/sort.js',
'tmp/reactable/td.js',
'tmp/reactable/tr.js',
'tmp/reactable/th.js',
'tmp/reactable/thead.js',
'tmp/reactable/tfoot.js',
'tmp/reactable/paginator.js',
'tmp/reactable/table.js',
'tmp/reactable.js'
],
dest: 'build/reactable.js'
}
},
file_append: {
umdHack: {
files: [{
prepend: 'window.React["default"] = window.React;\n' +
'window.ReactDOM["default"] = window.ReactDOM;\n',
input: 'build/reactable.js',
output: 'build/reactable.js'
}]
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
markdownlint: {
readme: {
"src": [ "README.md" ]
}
}
});
grunt.registerTask('testOnce', ['build', 'karma']);
grunt.registerTask('test', ['testOnce', 'watch:test']);
grunt.registerTask('ci', ['testOnce', 'markdownlint:readme'])
grunt.registerTask('buildBrowser', ['babel:umd', 'concat', 'file_append:umdHack'])
grunt.registerTask('build', ['babel:common', 'buildBrowser']);
grunt.registerTask('default', ['build', 'watch:build']);
};