This repository has been archived by the owner on Jun 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
66 lines (56 loc) · 1.61 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
module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
# Generate library from Peg grammar
peg:
fbp:
grammar: 'grammar/gtl-compiler.peg'
outputFile: 'lib/gtl-compiler.js'
# Build the browser Component
component_build:
'gtl-compiler':
output: './browser/'
config: './component.json'
scripts: true
styles: false
# JavaScript minification for the browser
uglify:
options:
report: 'min'
noflo:
files:
'./browser/gtl-compiler.min.js': ['./browser/gtl-compiler.js']
# Automated recompilation and testing when developing
watch:
files: ['spec/*.coffee', 'grammar/*.peg']
tasks: ['test']
# BDD tests on Node.js
cafemocha:
nodejs:
src: ['spec/*.coffee']
# CoffeeScript compilation
coffee:
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', ['peg', 'component_build', 'uglify']
@registerTask 'test', ['build', 'coffee', 'cafemocha', 'mocha_phantomjs']
@registerTask 'default', ['build']