forked from karma-runner/karma
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Gruntfile.coffee
149 lines (131 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
# JS Hint options
JSHINT_BROWSER =
browser: true,
strict: false
undef: false
camelcase: false
JSHINT_NODE =
node: true,
strict: false
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
pkgFile: 'package.json'
files:
server: ['lib/**/*.js']
client: ['client/**/*.js']
grunt: ['grunt.js', 'tasks/*.js']
scripts: ['scripts/init-dev-env.js']
browserify:
client:
files:
'static/karma.js': ['client/main.js']
test:
unit: 'simplemocha:unit'
client: 'test/client/karma.conf.js'
e2e: ['test/e2e/*/karma.conf.js', 'test/e2e/*/karma.conf.coffee', 'test/e2e/*/karma.conf.ls']
watch:
client:
files: '<%= files.client %>'
tasks: 'browserify:client'
simplemocha:
options:
ui: 'bdd'
reporter: 'dot'
unit:
src: [
'test/unit/mocha-globals.coffee'
'test/unit/**/*.coffee'
]
# JSHint options
# http://www.jshint.com/options/
jshint:
server:
files:
src: '<%= files.server %>'
options: JSHINT_NODE
grunt:
files:
src: '<%= files.grunt %>'
options: JSHINT_NODE
scripts:
files:
src: '<%= files.scripts %>'
options: JSHINT_NODE
client:
files:
src: '<%= files.client %>'
options: JSHINT_BROWSER
options:
quotmark: 'single'
bitwise: true
freeze: true
indent: 2
camelcase: true
strict: true
trailing: true
curly: true
eqeqeq: true
immed: true
latedef: true
newcap: true
noempty: true
unused: true
noarg: true
sub: true
undef: true
maxdepth: 4
maxstatements: 100
maxcomplexity: 100
maxlen: 100
globals: {}
# CoffeeLint options
# http://www.coffeelint.org/#options
coffeelint:
unittests: files: src: ['test/unit/**/*.coffee']
taskstests: files: src: ['test/tasks/**/*.coffee']
options:
max_line_length:
value: 100
jscs:
server: files: src: '<%= files.server %>'
client: files: src: '<%= files.client %>'
scripts: files: src: '<%= files.scripts %>'
grunt: files: src: '<%= files.grunt %>'
options:
config: '.jscs.json'
'npm-publish':
options:
requires: ['build']
abortIfDirty: true
tag: ->
minor = parseInt grunt.config('pkg.version').split('.')[1], 10
if (minor % 2) then 'canary' else 'latest'
'npm-contributors':
options:
commitMessage: 'chore: update contributors'
bump:
options:
updateConfigs: ['pkg']
commitFiles: ['package.json', 'CHANGELOG.md']
commitMessage: 'chore: release v%VERSION%'
push: false,
# A crazy hack.
# TODO(vojta): fix grunt-bump
gitDescribeOptions: '| echo "beta-$(git rev-parse --short HEAD)"'
grunt.loadTasks 'tasks'
# Load grunt tasks automatically
require('load-grunt-tasks') grunt
grunt.registerTask 'build', ['browserify:client']
grunt.registerTask 'default', ['build', 'test', 'lint']
grunt.registerTask 'lint', ['jshint', 'jscs', 'coffeelint']
grunt.registerTask 'release', 'Build, bump and publish to NPM.', (type) ->
grunt.task.run [
'npm-contributors'
"bump:#{type||'patch'}:bump-only"
'build'
'changelog'
'bump-commit'
'npm-publish'
]