@@ -47,7 +47,7 @@ export class Chromium extends ProviderClass implements ProviderInterface {
47
47
* Step 1: Download the json file that contains all the releases by OS. Each
48
48
* OS will have a list of release versions. The requested body will also be
49
49
* written to the out directory.
50
- *
50
+ *
51
51
* The requested url is https://omahaproxy.appspot.com/all.json. Some other
52
52
* urls include a timestamped csv https://omahaproxy.appspot.com/history.
53
53
* @return Promise of the all-json file.
@@ -60,7 +60,7 @@ export class Chromium extends ProviderClass implements ProviderInterface {
60
60
this . makeDirectory ( fileName ) ;
61
61
const httpOptions = { fileName, ignoreSSL : this . ignoreSSL ,
62
62
proxy : this . proxy } ;
63
-
63
+
64
64
if ( isExpired ( fileName ) ) {
65
65
const allJsonUrl = 'https://omahaproxy.appspot.com/all.json' ;
66
66
let contents = await requestBody ( allJsonUrl , httpOptions ) ;
@@ -79,7 +79,7 @@ export class Chromium extends ProviderClass implements ProviderInterface {
79
79
* Step 2: From the all-json object, make a request that matches the major
80
80
* version requested. The requested body will also be written to file in the
81
81
* out directory.
82
- *
82
+ *
83
83
* An example of a requsted url is
84
84
* https://omahaproxy.appspot.com/deps.json?version=72.0.3626.81
85
85
* @param allJson The all-json object.
@@ -109,11 +109,11 @@ export class Chromium extends ProviderClass implements ProviderInterface {
109
109
}
110
110
111
111
let workingFullVersion = '' ;
112
- let workingSemanticVersion = '0.0.0' ;
113
- for ( let item of all ) {
112
+ const workingSemanticVersion = '0.0.0' ;
113
+ for ( const item of all ) {
114
114
if ( item [ 'os' ] === os ) {
115
115
const versions = item [ 'versions' ] ;
116
- for ( let version of versions ) {
116
+ for ( const version of versions ) {
117
117
const fullVersion = version [ 'current_version' ] ;
118
118
const major = fullVersion . split ( '.' ) [ 0 ] ;
119
119
const minor = fullVersion . split ( '.' ) [ 1 ] ;
@@ -145,11 +145,11 @@ export class Chromium extends ProviderClass implements ProviderInterface {
145
145
* This is the "chromium_base_position" and make a request to the storage
146
146
* bucket. If the returned value is {"kind": "storage#objects"}, then
147
147
* decrement the revision number.
148
- *
148
+ *
149
149
* An example is the chromium_base_position revision number (612437).
150
150
* https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o?delimiter=/&prefix=Linux_x64/612437/
151
151
* returns {"kind": "storage#objects"}.
152
- *
152
+ *
153
153
* We keep decrementing the number until we reach 612434 where there is a list
154
154
* of items.
155
155
* @param downloadJson The download-version-json object.
@@ -181,7 +181,7 @@ export class Chromium extends ProviderClass implements ProviderInterface {
181
181
}
182
182
revisionUrl += os + '/' ;
183
183
let chromiumBasePosition : number = downloadJson [ 'chromium_base_position' ] ;
184
-
184
+
185
185
const httpOptions = { fileName, ignoreSSL : this . ignoreSSL ,
186
186
proxy : this . proxy } ;
187
187
while ( chromiumBasePosition > 0 ) {
@@ -203,23 +203,23 @@ export class Chromium extends ProviderClass implements ProviderInterface {
203
203
* Step 4: Get the download url for the chromium zip. Unzipping the zip file
204
204
* directory. The folders and binaries uncompressed are different for each OS.
205
205
* The following is examples of each OS:
206
- *
206
+ *
207
207
* downloads/
208
208
* |- chrome-linux/chrome
209
209
* |- chrome-mac/Chromium.app
210
210
* |- chrome-win/chrome.exe
211
- *
211
+ *
212
212
* @param storageObject The download-storage-json object
213
213
* @param majorVersion The major version, this must be a whole number.
214
214
*/
215
215
async downloadUrl ( storageObject : JsonObject , majorVersion : string
216
216
) : Promise < void > {
217
- const fileName = path . resolve ( this . outDir ,
217
+ const fileName = path . resolve ( this . outDir ,
218
218
this . compressedBinaryFileName . replace ( '.zip' , `-${ majorVersion } .zip` ) ) ;
219
219
if ( isExpired ( fileName ) ) {
220
220
const httpOptions = { fileName, ignoreSSL : this . ignoreSSL ,
221
221
proxy : this . proxy } ;
222
- for ( let item of storageObject [ 'items' ] as JsonObject [ ] ) {
222
+ for ( const item of storageObject [ 'items' ] as JsonObject [ ] ) {
223
223
const name : string = item [ 'name' ] ;
224
224
if ( name . indexOf ( 'chrome' ) >= 0 ) {
225
225
const downloadUrl = item [ 'mediaLink' ] ;
@@ -253,41 +253,41 @@ export class Chromium extends ProviderClass implements ProviderInterface {
253
253
downloadVersionJson , majorVersion ) ;
254
254
await this . downloadUrl ( storageObject , majorVersion ) ;
255
255
256
- let binaryFolder = ( ) : string => {
256
+ const binaryFolder = ( ) : string => {
257
257
if ( this . osType === 'Linux' ) {
258
258
return path . resolve ( this . outDir , 'chrome-linux' ) ;
259
259
} else if ( this . osType === 'Darwin' ) {
260
260
return path . resolve ( this . outDir ,
261
261
'chrome-mac/Chromium.app/Contents/MacOS' ) ;
262
262
} else if ( this . osType === 'Windows_NT' ) {
263
- return 'fix me' ;
263
+ return path . resolve ( this . outDir , 'chrome-win' ) ;
264
264
}
265
265
throw new Error ( 'os does not exist' ) ;
266
- }
266
+ } ;
267
267
268
- let binaryRegex = ( ) : RegExp => {
268
+ const binaryRegex = ( ) : RegExp => {
269
269
if ( this . osType === 'Linux' ) {
270
270
return / c h r o m e $ / g;
271
271
} else if ( this . osType === 'Darwin' ) {
272
272
return / C h r o m i u m / g;
273
273
} else if ( this . osType === 'Windows_NT' ) {
274
- return / f i x - m e / g;
274
+ return / c h r o m e \. e x e / g;
275
275
}
276
276
throw new Error ( 'os does not exist' ) ;
277
277
} ;
278
278
279
- let binaryFile = ( ) : string => {
279
+ const binaryFile = ( ) : string => {
280
280
if ( this . osType === 'Linux' ) {
281
281
return path . resolve ( this . outDir , 'chrome-linux/chrome' ) ;
282
282
} else if ( this . osType === 'Darwin' ) {
283
283
return path . resolve ( this . outDir ,
284
284
'chrome-mac/Chromium.app/Contents/MacOS/Chromium' ) ;
285
285
} else if ( this . osType === 'Windows_NT' ) {
286
- return 'fix me ' ;
286
+ return 'chrome-win/chrome.exe ' ;
287
287
}
288
288
throw new Error ( 'os does not exist' ) ;
289
- }
290
-
289
+ } ;
290
+
291
291
generateConfigFile ( binaryFolder ( ) ,
292
292
path . resolve ( this . outDir , this . configFileName ) ,
293
293
binaryRegex ( ) , binaryFile ( ) ) ;
@@ -310,7 +310,7 @@ export class Chromium extends ProviderClass implements ProviderInterface {
310
310
const regex = / c h r o m i u m \- v e r s i o n \- ( \d + ) \. j s o n / g;
311
311
const exec = regex . exec ( existFile ) ;
312
312
if ( exec ) {
313
- return exec [ 1 ] ;
313
+ return exec [ 1 ] ;
314
314
}
315
315
}
316
316
}
@@ -329,7 +329,7 @@ export class Chromium extends ProviderClass implements ProviderInterface {
329
329
} else if ( this . osType === 'Windows_NT' ) {
330
330
chromiumPath = 'chrome-win/' ;
331
331
}
332
-
332
+
333
333
rimraf . sync ( path . resolve ( this . outDir , chromiumPath ) ) ;
334
334
const files = removeFiles ( this . outDir , [ / c h r o m i u m .* / g] ) ;
335
335
try {
0 commit comments