@@ -4,6 +4,7 @@ import ora from 'ora'
4
4
import http from 'http'
5
5
import https from 'https'
6
6
import humanSize from 'human-size'
7
+ import { merge } from 'lodash'
7
8
8
9
// To increase s3's download & upload dir perf
9
10
http . globalAgent . maxSockets = https . globalAgent . maxSockets = 30
@@ -25,29 +26,29 @@ const jsonDocsDirDownloadOptions = {
25
26
} ,
26
27
}
27
28
28
- const jsonDocsDirUploadOptions = {
29
- localDir : 'tmp/json-docs' ,
29
+ const jsonDocsDirUploadOptions = merge ( { } , jsonDocsDirDownloadOptions , {
30
30
s3Params : {
31
- //ACL: 'public-read',
32
- Bucket : 'api-docs.emberjs.com' ,
31
+ ACL : 'public-read' ,
33
32
CacheControl : 'max-age=365000000, immutable' ,
34
33
GrantRead : 'uri=http://acs.amazonaws.com/groups/global/AllUsers' ,
35
- //maxRetries: 5,
36
- Prefix : 'json-docs' ,
37
34
} ,
38
- }
35
+ } )
39
36
40
- const revDocsDirUploadOptions = {
37
+ let revDocsDirDownloadOptions = {
41
38
localDir : 'tmp/rev-index' ,
42
39
s3Params : {
43
- //ACL: 'public-read',
44
40
Bucket : 'api-docs.emberjs.com' ,
45
- GrantRead : 'uri=http://acs.amazonaws.com/groups/global/AllUsers' ,
46
- //maxRetries: 5,
47
41
Prefix : 'rev-index' ,
48
42
} ,
49
43
}
50
44
45
+ const revDocsDirUploadOptions = merge ( { } , revDocsDirDownloadOptions , {
46
+ s3Params : {
47
+ ACL : 'public-read' ,
48
+ GrantRead : 'uri=http://acs.amazonaws.com/groups/global/AllUsers' ,
49
+ } ,
50
+ } )
51
+
51
52
const syncDir = ( operation , options ) => {
52
53
return new Promise ( ( resolve , reject ) => {
53
54
let isDownload = operation === 'download'
@@ -75,9 +76,6 @@ const syncDir = (operation, options) => {
75
76
}
76
77
77
78
export function downloadExistingDocsToLocal ( ) {
78
- let revDocsDirDownloadOptions = revDocsDirUploadOptions
79
- delete revDocsDirDownloadOptions . s3Params . GrantRead
80
-
81
79
return waitForAllPromises ( [
82
80
syncDir ( 'download' , jsonDocsDirDownloadOptions ) ,
83
81
syncDir ( 'download' , revDocsDirDownloadOptions ) ,
0 commit comments