This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
182 lines (179 loc) · 6.97 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
express: {
capturejs: {
options: {
hostname: '0.0.0.0',
port: 3000,
base: '.',
debug: true
}
},
test: {
options: {
hostname: '0.0.0.0',
port: 3001,
base: '.',
debug: true
}
}
},
qunit: {
capturejs: {
options: {
timeout: 20000,
urls: [
'http://localhost:3001/tests/index.html',
]
}
}
},
browserify: {
capturejs: {
src: ['src/capture.js'],
dest: 'build/capture.js'
},
},
uglify: {
capturejs: {
files: {
'build/capture.min.js': ['build/capture.js']
}
},
},
watch: {
files: ["src/**/*.js"
],
tasks: ['build'],
},
'saucelabs-qunit': {
capturejs: {
options: {
// Set the Saucelabs username and key in your environment variables
// by setting SAUCE_USERNAME and SAUCE_ACCESS_KEY
urls: [
'http://localhost:3001/tests/index.html'
],
testname: 'CaptureJS QUnit Tests',
concurrency: 16,
tunneled: true,
detailedError: true,
// Poll for status every 10 seconds for 10 minutes
pollInterval: 10000,
statusCheckAttempts: 60,
// For available browsers and how to configure them see
// https://saucelabs.com/docs/platforms and
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
browsers: [
{ // IE 10 on Windows 8
browserName: 'internet explorer',
platform: 'Windows 2012',
version: '10'
},
{ // IE 11 on Windows 8.1
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
{ // Latest IE Edge on Windows 10
browserName: 'MicrosoftEdge',
platform: 'Windows 10'
},
{ // Latest Chrome on Windows 10
browserName: 'chrome',
platform: 'Windows 10'
},
{ // Latest Chrome on Linux (unknown distro)
browserName: 'chrome',
platform: 'Linux'
},
{ // Latest Chrome on macOS 10.13
browserName: 'chrome',
platform: 'macOS 10.13'
},
{ // Lowest known working version of FF
platform: 'Windows 10',
browserName: 'firefox',
version: '4.0'
},
{ // Highest known working version of FF on Windows
platform: 'Windows 10',
browserName: 'firefox',
},
{ // Newest iOS simulator as of 2019-04-02
browserName: 'ipad',
platform: 'macOS 10.13',
version: '12.0'
},
{ // Oldest iOS simulator as of 2019-04-02
browserName: 'ipad',
platform: 'macOS 10.11',
version: '9.3'
},
{ // Newest iOS simulator as of 2019-04-02
browserName: 'iphone',
platform: 'macOS 10.13',
version: '12.0'
},
{ // Oldest iOS simulator as of 2019-04-02
browserName: 'iphone',
platform: 'macOS 10.11',
version: '9.3'
},
{ // Android 4.4 Android Browser (simulator)
browserName: 'android',
platform: 'Linux',
version: '4.4'
},
{ // Android 8.0 Chrome? (simulator)
browserName: 'android',
platform: 'Linux',
version: '8.0'
},
]
}
}
},
aws_s3: {
capturejs: {
options: {
bucket: 'mobify',
params: {
CacheControl: "public,max-age=1800", // cache for 30 min
}
},
files: [
{ // unminified dev build
src: ["build/capture.js"],
dest: "capturejs/capture-<%= pkg.version %>.js",
},
{ // unminified dev build to latest
src: ["build/capture.js"],
dest: "capturejs/capture-latest.js",
},
{ // minified production build
src: ["build/capture.min.js"],
dest: "capturejs/capture-<%= pkg.version %>.min.js",
},
{ // minified production build to latest
src: ["build/capture.min.js"],
dest: "capturejs/capture-latest.min.js",
}
]
}
}
});
grunt.loadNpmTasks('grunt-express');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('build', ['browserify', 'uglify']);
grunt.registerTask('saucelabs', ['test', 'saucelabs-qunit']);
grunt.registerTask('test', ['build', 'express:test', 'qunit']);
grunt.registerTask('serve', ['build', 'express:capturejs', 'watch']);
grunt.registerTask('deploy', ['build', 'aws_s3']);
};