-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.coffee
78 lines (68 loc) · 1.85 KB
/
Gruntfile.coffee
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
module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
# Generate library from Peg grammar
peg:
parser:
src: 'src/grammar.peg'
dest: 'lib/parser.js'
# Build the browser Component
componentbuild:
'vfl-compiler':
options:
name: 'vfl-compiler'
src: '.'
dest: 'browser'
scripts: true
styles: false
# JavaScript minification for the browser
uglify:
options:
report: 'min'
'vfl-compiler':
files:
'./browser/vfl-compiler.min.js': ['./browser/vfl-compiler.js']
# Automated recompilation and testing when developing
watch:
files: ['spec/**/*.coffee', 'src/**/*.{coffee,peg}']
tasks: ['test']
# BDD tests on Node.js
cafemocha:
nodejs:
src: ['spec/**/*.coffee']
options:
reporter: 'spec'
# CoffeeScript compilation
coffee:
src:
options:
bare: true
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
spec:
options:
bare: true
expand: true
cwd: 'spec'
src: ['**/*.coffee']
dest: 'spec'
ext: '.js'
# BDD tests on browser
mocha_phantomjs:
all: ['spec/runner.html']
# Grunt plugins used for building
@loadNpmTasks 'grunt-peg'
@loadNpmTasks 'grunt-component-build'
@loadNpmTasks 'grunt-contrib-uglify'
# Grunt plugins used for testing
@loadNpmTasks 'grunt-cafe-mocha'
@loadNpmTasks 'grunt-contrib-coffee'
@loadNpmTasks 'grunt-mocha-phantomjs'
@loadNpmTasks 'grunt-contrib-watch'
@registerTask 'build', ['coffee:src', 'peg', 'componentbuild', 'uglify']
@registerTask 'test', ['build', 'coffee:spec', 'cafemocha', 'mocha_phantomjs']
@registerTask 'default', ['build']