-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.coffee
165 lines (150 loc) · 3.54 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
path = require 'path'
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
clean:
reset:
src: ['bin']
temp:
src: ['temp']
bin:
src: ['bin/client']
coffeeLint:
scripts:
files: [
{
expand: true
src: ['client/**/*.coffee']
}
{
expand: true
src: ['server/**/*.coffee']
}
]
options:
indentation:
value: 2
level: 'error'
no_plusplus:
level: 'error'
tests:
files: [
{
expand: true
src: ['test/**/*.coffee']
}
]
options:
indentation:
value: 2
level: 'error'
no_plusplus:
level: 'error'
coffee:
scripts:
expand: true
cwd: 'client/coffee'
src: ['**/*.coffee']
dest: 'temp/client/js/'
ext: '.js'
options:
bare: true
ngTemplateCache:
views:
files:
'./temp/client/js/views.js': './client/views/*.html'
options:
trim: './client'
copy:
dev:
expand: true
cwd: 'temp/'
src: ['**']
dest: 'bin'
components:
flatten: true
expand: true
cwd: 'bower_modules'
src: [
'angular/angular.js'
]
dest: 'temp/client/js/libs'
template:
dev:
dest: 'bin/client/index.html'
src: 'client/index.template'
environment: 'dev'
prod:
dest: 'temp/client/index.html'
src: '<%= template.dev.src %>'
environment: 'prod'
test:
dest: '<%= template.dev.dest %>'
src: '<%= template.dev.src %>'
environment: 'test'
# optimizes files managed by RequireJS
requirejs:
scripts:
options:
baseUrl: 'temp/client/js/'
findNestedDependencies: true
logLevel: 0
mainConfigFile: 'temp/client/js/main.js'
name: 'main'
onBuildWrite: (moduleName, path, contents) ->
modulesToExclude = ['main']
shouldExcludeModule = modulesToExclude.indexOf(moduleName) >= 0
if (shouldExcludeModule)
return ''
return contents
# optimize: 'uglify'
optimize: 'none'
out: 'bin/client/js/scripts.min.js'
preserveLicenseComments: false
skipModuleInsertion: true
uglify:
no_mangle: false
connect:
dev:
options:
hostname: '*'
keepalive: true
port: 9001
base: 'bin/client'
test:
options:
hostname: '*'
port: 9001
base: 'bin/client'
cucumberjs:
files: 'features/*.feature'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-requirejs'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-cucumber'
grunt.loadNpmTasks 'grunt-gint'
grunt.registerTask 'server', [
'connect:dev'
]
grunt.registerTask 'build', [
'clean'
'coffeeLint'
'coffee'
'ngTemplateCache'
'copy:components'
'requirejs'
'template:dev'
'clean:temp'
]
grunt.registerTask 'test', [
'build'
'connect:test'
'cucumberjs'
]
grunt.registerTask 'default', [
'build'
'test'
'clean:bin'
]