forked from EragonJ/Trip.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
159 lines (155 loc) · 4.02 KB
/
Gruntfile.js
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
module.exports = function(grunt) {
var pathToInk = 'node_modules/grunt-jsdoc/node_modules/ink-docstrap';
// Project configuration.
grunt.initConfig({
qunit: {
all: {
options: {
timeout: 10000,
urls: [
'http://localhost:8000/tests/trip_events/test.html',
'http://localhost:8000/tests/directions/test.html',
'http://localhost:8000/tests/themes/test.html',
'http://localhost:8000/tests/key_events/test.html',
'http://localhost:8000/tests/integration/test.html',
]
}
}
},
connect: {
server: {
option: {
port: 8000,
base: 'tests'
}
}
},
uglify: {
my_target: {
options: {
preserveComments: 'some'
},
files: {
'src/trip.min.js': ['src/trip.js']
}
}
},
sass: {
dist_non_compressed: {
options: {
compass: true
},
files: {
'src/trip.css': 'src/trip.scss'
}
},
dist_compressed: {
options: {
compass: true,
style: 'compressed'
},
files: {
'src/trip.min.css': 'src/trip.scss'
}
}
},
jade: {
compile: {
options: {
pretty: true
},
files: {
'demo-basic.html': 'views/demo-basic.jade',
'doc/documentation-1.3.html': 'views/documentation-1.3.jade',
'doc/documentation.html': 'views/documentation.jade',
'index.html': 'views/index.jade'
}
}
},
jshint: {
options: {
maxlen: 80,
globals: {
jQuery: true
}
},
all: [
'Gruntfile.js',
'src/trip.js'
],
},
replace: {
configfiles: {
src: [
'trip.jquery.json',
'package.json',
'component.json'
],
overwrite: true,
replacements: [{
from: (function() {
return new RegExp('"version": "' + grunt.option('oldv') + '",');
})(),
to: function() {
return '"version": "' + grunt.option('newv') + '",';
}
}]
},
sourcefiles: {
src: [
'views/index.jade',
'src/trip.js',
'README.md'
],
overwrite: true,
replacements: [{
from: (function() {
return new RegExp(grunt.option('oldv'));
})(),
to: function() {
return grunt.option('newv');
}
}]
}
},
jsdoc: {
dist: {
src: ['src/trip.js', '.jsdoc_index.md'],
options: {
destination: 'doc',
template : pathToInk + '/template',
configure : pathToInk + '/template/jsdoc.conf.json'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-text-replace');
// Default task(s).
grunt.registerTask('test', ['jshint', 'connect', 'qunit']);
grunt.registerTask('html', ['jade']);
grunt.registerTask('scss', ['sass']);
grunt.registerTask('minify', ['jshint', 'uglify']);
grunt.registerTask('build', ['minify', 'sass']);
grunt.registerTask('doc', ['jsdoc', 'jade']);
grunt.registerTask('all', ['build', 'doc']);
grunt.registerTask('bumpversion',
['replace:configfiles', 'replace:sourcefiles', 'build', 'doc']);
// How to bump version ?
//
// grunt bumpversion --oldv=1.3.0 --newv=2.0.0
//
// NOTE:
//
// 1. After bumping versions, we will also build again to make sure
// this change old get reflected into built files also.
//
// 2. Because the matching rule is very easy, we have to check version
// again after bumping to make sure we won't override the wrong words.
};