forked from auth0/styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
118 lines (109 loc) · 2.65 KB
/
Copy pathGruntfile.js
File metadata and controls
118 lines (109 loc) · 2.65 KB
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
var pkg = require('./package');
var minorVersion = pkg.version.replace(/\.(\d)*$/, '');
var majorVersion = pkg.version.replace(/\.(\d)*\.(\d)*$/, '');
var path = require('path');
var join = path.join;
module.exports = function (grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
clean: [
'build/'
],
shell: {
fix_utf8: {
command: './bin/fix-utf8-problem lib/budicon/budicon.css lib/budicon/budicon.fixed.css'
},
gulp: {
command: './node_modules/.bin/gulp build'
},
gulp_dev: {
command: './node_modules/.bin/gulp',
options: {
execOptions: {
maxBuffer: Infinity
}
}
}
},
aws_s3: {
options: {
accessKeyId: process.env.S3_KEY,
secretAccessKey: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET,
region: process.env.S3_REGION,
uploadConcurrency: 5,
params: {
CacheControl: 'public, max-age=300'
}
},
publish: {
files: [{
src: ['**'],
dest: 'styleguide/' + majorVersion + '/',
expand: true,
cwd: 'build/'
},{
src: ['**'],
dest: 'styleguide/' + minorVersion + '/',
expand: true,
cwd: 'build/'
},{
src: ['**'],
dest: 'styleguide/' + pkg.version + '/',
expand: true,
cwd: 'build/'
},{
src: ['**'],
dest: 'styleguide/latest/',
expand: true,
cwd: 'build/'
}]
}
},
http: {
purge_styleguide: {
options: {
url: process.env.STYLEGUIDE_ROOT + '/*',
method: 'DELETE'
}
},
purge_cdn_latest: {
options: {
url: process.env.CDN_ROOT + '/styleguide/latest',
method: 'DELETE'
}
},
purge_cdn_major: {
options: {
url: process.env.CDN_ROOT + '/styleguide/styleguide/' + majorVersion,
method: 'DELETE'
}
},
purge_cdn_minor: {
options: {
url: process.env.CDN_ROOT + '/styleguide/styleguide/' + minorVersion,
method: 'DELETE'
}
}
}
});
grunt.registerTask('build', [
'clean',
'shell:fix_utf8',
'shell:gulp'
]);
grunt.registerTask('dev', [
'clean',
'shell:fix_utf8',
'shell:gulp_dev'
]);
grunt.registerTask('cdn', [
'build',
'aws_s3',
'http:purge_styleguide',
'http:purge_cdn_latest',
'http:purge_cdn_major',
'http:purge_cdn_minor'
]);
grunt.registerTask('default', ['build']);
};