-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Gruntfile.js
101 lines (94 loc) · 3.09 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
module.exports = function (grunt) {
'use strict'
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
usebanner: {
taskName: {
options: {
position: 'top',
banner: '/* \n @package NOTY - Dependency-free notification library \n' +
' @version version: <%= pkg.version %> \n' +
' @contributors https://github.com/needim/noty/graphs/contributors \n' +
' @documentation Examples and Documentation - https://ned.im/noty \n' +
' @license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php \n*/\n',
linebreak: true
},
files: {
src: ['lib/noty.js', 'lib/noty.min.js']
}
}
},
qunit: {
options: {
inject: 'test/unit/phantom.js'
},
files: 'test/index.html'
},
connect: {
server: {
options: {
port: 3000,
base: '.'
}
}
},
sass: {
dist: {
options: {
style: 'expanded',
sourcemap: 'file'
},
files: [{
expand: true,
cwd: 'src/themes',
src: ['*.scss'],
dest: 'lib/themes',
ext: '.css'
}]
}
},
curl: {
builds: {
src: {
url: 'https://www.browserstack.com/automate/builds.json',
auth: {
user: process.env.BROWSERSTACK_USERNAME,
pass: process.env.BROWSERSTACK_KEY
}
},
dest: 'browserstack-builds.json'
},
session: {
src: {
url: 'https://www.browserstack.com/automate/builds/' + grunt.file.readJSON('browserstack-builds.json')[0]['automation_build']['hashed_id'] + '/sessions.json',
auth: {
user: process.env.BROWSERSTACK_USERNAME,
pass: process.env.BROWSERSTACK_KEY
}
},
dest: 'browserstack-session.json'
}
}
})
require('load-grunt-tasks')(grunt)
grunt.registerTask('bs-create-md', function () {
const session = grunt.file.readJSON('browserstack-session.json')
const file = 'docs/browsers.md'
let contents = '!> This data is provided by BrowserStack Automate \n\n\n'
contents += `#### ${session[0].automation_session.build_name} \n\n`
contents += '| OS | Browser | Result | Details | \n'
contents += '| --- | --- | --- | --- | \n'
session.forEach(function (s) {
grunt.log.writeln(s.automation_session.hashed_id)
contents += `| ${s.automation_session.os} ${s.automation_session.os_version} | ${s.automation_session.browser} ${s.automation_session.browser_version} | ${s.automation_session.status} | [view](${s.automation_session.public_url}) |`
contents += '\n'
})
grunt.file.write(file, contents)
})
grunt.registerTask('browserstack-md', ['curl:builds', 'curl:session', 'bs-create-md'])
grunt.registerTask('banner', 'usebanner')
grunt.registerTask('test', 'qunit')
grunt.registerTask('saucelabs', ['qunit', 'connect', 'saucelabs-qunit'])
grunt.registerTask('default', ['test'])
grunt.registerTask('themes', ['sass'])
}