-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
99 lines (93 loc) · 2.57 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
// 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: ['tests/src/**/*.jsx','src/**/*.jsx'],
tasks: ['test']
}
},
babel: {
options: { sourceRoot: 'src' },
common: {
files: {
'lib/reactable-cacheable.js': 'src/reactable-cacheable.jsx',
'lib/reactable-cacheable/cacheable-table.js': 'src/reactable-cacheable/cacheable-table.jsx',
'lib/reactable-cacheable/cacheable-row.js': 'src/reactable-cacheable/cacheable-row.jsx',
// 'lib/lib/extract_data_from.js': 'src/lib/extract_data_from.jsx',
},
// options: { modules: 'common' }
},
test: {
files: {
'tests/src/reactable-cacheable-test.js': 'tests/src/reactable-cacheable-test.jsx',
}
// options: { modules: 'common' }
}
},
concat: {
dist: {
src: [
'tmp/reactable-cacheable.js'
],
dest: 'build/reactable-cacheable.js'
}
},
file_append: {
umdHack: {
files: [{
prepend: 'window.React["default"] = window.React;\n' +
'window.ReactDOM["default"] = window.ReactDOM;\n',
input: 'build/reactable-cacheable.js',
output: 'build/reactable-cacheable.js'
}]
}
},
browserify: {
test: {
src: 'tests/src/reactable-cacheable-test.js',
dest: 'tests/build/js/init.js'
},
build: {
src: 'lib/reactable-cacheable.js',
dest: 'build/reactable-cacheable.js'
}
},
'http-server': {
dev: {
root: 'tests/build/',
port: 8888,
},
}
/*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']);
grunt.registerTask('build', ['babel:common','browserify:build'])
grunt.registerTask('test', ['build', 'babel:test','browserify:test','watch:test','http-server:dev']);
};