forked from auth0/auth0.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
125 lines (122 loc) · 3.23 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
var fs = require('fs');
var pkg = require('./package');
module.exports = function(grunt) {
grunt.initConfig({
connect: {
test: {
options: {
hostname: '0.0.0.0',
port: 9999
}
},
example: {
options: {
base: "example",
port: 3000
}
},
example_https: {
options: {
base: "example",
port: 3000,
protocol: 'https',
hostname: '*',
cert: fs.readFileSync(__dirname + '/test/https_test_certs/server.crt').toString(),
key: fs.readFileSync(__dirname + '/test/https_test_certs/server.key').toString(),
}
}
},
browserify: {
dist: {
files: {
'build/auth0.js': ['standalone.js'],
}
},
debug: {
files: {
'build/auth0.debug.js': ['standalone.js'],
},
options: {
debug: true
}
}
},
uglify: {
options: {
ascii: true
}, min: {
files: {
'build/auth0.min.js': ['build/auth0.js']
}
}
},
copy: {
example: {
files: {
'example/auth0.js': 'build/auth0.js',
}
}
},
clean: {
build: ["build/", "example/auth0.js"],
},
watch: {
another: {
files: ['node_modules', 'standalone.js', 'lib/*.js'],
tasks: ['build']
}
},
exec: {
'test-phantom': {
cmd: 'node_modules/testem/testem.js -f testem_dev.yml ci -l PhantomJS',
stdout: true,
stderr: true
},
'test-desktop': {
cmd: 'node_modules/testem/testem.js ci -l bs_chrome,bs_firefox,bs_ie_8,bs_ie_9,bs_ie_10',
stdout: true,
stderr: true
},
'test-mobile': {
cmd: 'node_modules/testem/testem.js ci -l bs_iphone_5', //disable ,bs_android_41: is not working
stdout: true,
stderr: true
}
},
s3: {
options: {
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
access: 'public-read',
headers: {
'Cache-Control': 'public, max-age=300',
}
},
publish: {
upload: [
{
src: 'build/auth0.min.js',
dest: 'w2/auth0-' + pkg.version + '.min.js',
options: { gzip: true }
},
{
src: 'build/auth0.debug.js',
dest: 'w2/auth0-' + pkg.version + '.js'
},
]
}
}
});
// Loading dependencies
for (var key in grunt.file.readJSON("package.json").devDependencies) {
if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
}
grunt.registerTask("build", ["clean", "browserify:dist", "browserify:debug", "uglify:min", "copy:example"]);
grunt.registerTask("example", ["connect:example", "watch", "build"]);
grunt.registerTask("example_https", ["connect:example_https", "watch", "build"]);
grunt.registerTask("dev", ["connect:test", "watch", "build"]);
grunt.registerTask("test", ["exec:test-phantom"]);
grunt.registerTask("integration", ["exec:test-desktop", "exec:test-mobile"]);
grunt.registerTask("cdn", ["s3"]);
};