-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
107 lines (93 loc) · 2.75 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
# CoffeeScript compilation
coffee:
spec:
options:
bare: true
expand: true
cwd: 'spec'
src: ['**.coffee']
dest: 'spec'
ext: '.js'
# Browser version building
component:
install:
options:
action: 'install'
component_build:
'noflo-clutter':
output: './browser/'
config: './component.json'
scripts: true
styles: false
plugins: ['coffee']
configure: (builder) ->
# Enable Component plugins
json = require 'component-json'
builder.use json()
# Fix broken Component aliases, as mentioned in
# https://github.com/anthonyshort/component-coffee/issues/3
combine:
browser:
input: 'browser/noflo-clutter.js'
output: 'browser/noflo-clutter.js'
tokens: [
token: '.coffee'
string: '.js'
]
# JavaScript minification for the browser
uglify:
options:
report: 'min'
noflo:
files:
'./browser/noflo-clutter.min.js': ['./browser/noflo-clutter.js']
# Editor's UI
exec:
ui_install:
command: 'npm install'
cwd: './node_modules/noflo-ui'
ui_nuke:
command: 'grunt nuke'
cwd: './node_modules/noflo-ui'
ui_build:
command: 'grunt build'
cwd: './node_modules/noflo-ui'
# Automated recompilation and testing when developing
watch:
files: ['spec/*.coffee', 'components/*.coffee', 'graphs/*.json']
tasks: ['test']
# Coding standards
coffeelint:
components: ['components/*.coffee']
# Grunt plugins used for building
@loadNpmTasks 'grunt-contrib-coffee'
@loadNpmTasks 'grunt-component'
@loadNpmTasks 'grunt-component-build'
@loadNpmTasks 'grunt-combine'
@loadNpmTasks 'grunt-contrib-uglify'
# Grunt plugins used for testing
@loadNpmTasks 'grunt-contrib-watch'
@loadNpmTasks 'grunt-coffeelint'
@loadNpmTasks 'grunt-exec'
# Our local tasks
@registerTask 'ui', 'Build NoFlo web UI', (target = 'all') =>
@task.run 'exec'
@registerTask 'build', 'Build NoFlo for the chosen target platform', (target = 'all') =>
@task.run 'coffee'
if target is 'all' or target is 'browser'
@task.run 'component'
@task.run 'component_build'
@task.run 'combine'
@task.run 'uglify'
@registerTask 'test', 'Build NoFlo and run automated tests', (target = 'all') =>
@task.run 'coffeelint'
@task.run 'coffee'
if target is 'all' or target is 'browser'
@task.run 'component'
@task.run 'component_build'
@task.run 'combine'
@registerTask 'default', ['test']