forked from hammerjs/hammer.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
133 lines (119 loc) · 3.52 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
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
# meta options
meta:
banner: '
/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n
* <%= pkg.homepage %>\n
*\n
* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> <<%= pkg.author.email %>>;\n
* Licensed under the <%= _.pluck(pkg.licenses, "type").join(", ") %> license */\n\n'
# concat src files
concat:
options:
separator: '\n\n'
dist:
options:
banner: '<%= meta.banner %>'
src: [
'src/intro.js'
'src/core.js'
'src/setup.js'
'src/instance.js'
'src/event.js'
'src/pointerevent.js'
'src/utils.js'
'src/detection.js'
'src/gestures/*.js'
'src/outro.js']
dest: 'hammer.js'
# minify the sourcecode
uglify:
options:
report: 'gzip'
sourceMap: 'hammer.min.map'
banner: '<%= meta.banner %>'
dist:
files:
'hammer.min.js': ['hammer.js']
# check for optimisations and errors
jshint:
options:
curly: true
expr: true
newcap: true
quotmark: 'single'
regexdash: true
trailing: true
undef: true
unused: true
maxerr: 100
eqnull: true
sub: false
browser: true
node: true
strict: true
laxcomma: true
globals:
define: false
dist:
src: ['hammer.js']
# watch for changes
watch:
scripts:
files: ['src/**/*.js']
tasks: ['concat']
options:
interrupt: true
# simple node server
connect:
server:
options:
hostname: "0.0.0.0"
# release
tagrelease:
file: 'package.json'
commit: true
message: 'Release %version%'
prefix: 'v'
annotate: false
# tests
qunit:
all: ['tests/**/*.html']
# saucelabs tests
'saucelabs-qunit':
all:
options:
username: 'hammerjs-ci'
key: '2ede6d02-65b3-4ba9-aec8-44a787af0c81'
build: process.env.TRAVIS_JOB_ID || 'dev'
concurrency: 3
urls: [
'http://0.0.0.0:8000/tests/utils.html',
'http://0.0.0.0:8000/tests/mouseevents.html',
'http://0.0.0.0:8000/tests/mousetouchevents.html',
'http://0.0.0.0:8000/tests/touchevents.html',
'http://0.0.0.0:8000/tests/pointerevents_mouse.html',
'http://0.0.0.0:8000/tests/pointerevents_touch.html'
]
browsers: [
{ browserName: 'chrome' }
{ browserName: 'firefox' }
{ browserName: 'internet explorer', platform: 'Windows 7', version: '9' }
{ browserName: 'internet explorer', platform: 'Windows 8', version: '10'}
]
# Load tasks
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-qunit'
grunt.loadNpmTasks 'grunt-saucelabs'
grunt.loadNpmTasks 'grunt-tagrelease'
# Default task(s).
grunt.registerTask 'default', ['connect','watch']
grunt.registerTask 'build', ['concat','uglify','test']
grunt.registerTask 'test', ['jshint','qunit']
grunt.registerTask 'test-full', ['build','jshint','connect','saucelabs-qunit']