UNPKG

1.6 kBtext/coffeescriptView Raw
1module.exports = ->
2 # Project configuration
3 @initConfig
4 pkg: @file.readJSON 'package.json'
5
6 # Generate library from Peg grammar
7 peg:
8 fbp:
9 grammar: 'grammar/fbp.peg'
10 outputFile: 'lib/fbp.js'
11
12 # Build the browser Component
13 component_build:
14 'fbp':
15 output: './browser/'
16 config: './component.json'
17 scripts: true
18 styles: false
19
20 # JavaScript minification for the browser
21 uglify:
22 options:
23 report: 'min'
24 noflo:
25 files:
26 './browser/fbp.min.js': ['./browser/fbp.js']
27
28 # Automated recompilation and testing when developing
29 watch:
30 files: ['spec/*.coffee', 'grammar/*.peg']
31 tasks: ['test']
32
33 # BDD tests on Node.js
34 cafemocha:
35 nodejs:
36 src: ['spec/*.coffee']
37
38 # CoffeeScript compilation
39 coffee:
40 spec:
41 options:
42 bare: true
43 expand: true
44 cwd: 'spec'
45 src: ['**.coffee']
46 dest: 'spec'
47 ext: '.js'
48
49 # BDD tests on browser
50 mocha_phantomjs:
51 all: ['spec/runner.html']
52
53 # Grunt plugins used for building
54 @loadNpmTasks 'grunt-peg'
55 @loadNpmTasks 'grunt-component-build'
56 @loadNpmTasks 'grunt-contrib-uglify'
57
58 # Grunt plugins used for testing
59 @loadNpmTasks 'grunt-cafe-mocha'
60 @loadNpmTasks 'grunt-contrib-coffee'
61 @loadNpmTasks 'grunt-mocha-phantomjs'
62 @loadNpmTasks 'grunt-contrib-watch'
63
64 @registerTask 'build', ['peg', 'component_build', 'uglify']
65 @registerTask 'test', ['build', 'coffee', 'cafemocha', 'mocha_phantomjs']
66 @registerTask 'default', ['build']