-
Notifications
You must be signed in to change notification settings - Fork 19
/
Gruntfile.js
81 lines (72 loc) · 1.71 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
module.exports = function () {
// Project configuration
this.initConfig({
pkg: this.file.readJSON('package.json'),
// Generate library from Peg grammar
peg: {
fbp: {
src: 'grammar/fbp.peg',
dest: 'lib/fbp.js',
},
},
yaml: {
schemas: {
files: [{
expand: true,
cwd: 'schemata/',
src: '*.yaml',
dest: 'schema/',
},
],
},
},
// Build the browser Component
noflo_browser: {
build: {
files: {
'browser/fbp.js': ['browser/entry.js'],
},
options: {
manifest: {
runtimes: ['noflo'],
discover: true,
recursive: true,
silent: true,
},
},
},
},
// Automated recompilation and testing when developing
watch: {
files: ['spec/*.js', 'grammar/*.peg'],
tasks: ['test'],
},
// BDD tests on Node.js
mochaTest: {
nodejs: {
src: ['spec/*.js'],
options: {
reporter: 'spec',
require: 'spec/utils/inject.js',
},
},
},
// BDD tests on browser
karma: {
unit: {
configFile: 'karma.config.js',
},
},
});
// Grunt plugins used for building
this.loadNpmTasks('grunt-yaml');
this.loadNpmTasks('grunt-peg');
this.loadNpmTasks('grunt-noflo-browser');
// Grunt plugins used for testing
this.loadNpmTasks('grunt-mocha-test');
this.loadNpmTasks('grunt-karma');
this.loadNpmTasks('grunt-contrib-watch');
this.registerTask('build', ['peg', 'yaml', 'noflo_browser']);
this.registerTask('test', ['build', 'mochaTest', 'karma']);
this.registerTask('default', ['build']);
};