This repository was archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 40
refactor: fetch v8Versions map from external url #242
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"generate-android-snapshot": "./bin/generate-android-snapshot" | ||
}, | ||
"dependencies": { | ||
"semver": "^5.4.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An exact version would be better IMO - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the semver package will follow the semver versioning. Also if there are some changes that they need to introduce because of new node/npm versions, they'll probably do it with minor releses and not patches. |
||
"shelljs": "^0.6.0" | ||
}, | ||
"devDependencies": {} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
snapshot/android/utils.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const https = require("https"); | ||
|
||
const shelljs = require("shelljs"); | ||
|
||
const downloadFile = (url, destinationFilePath) => | ||
new Promise((resolve, reject) => { | ||
const request = https.get(url, response => { | ||
switch (response.statusCode) { | ||
case 200: | ||
shelljs.mkdir("-p", dirname(destinationFilePath)); | ||
const file = fs.createWriteStream(destinationFilePath); | ||
file.on('error', function (error) { | ||
return reject(error); | ||
}); | ||
file.on("finish", function() { | ||
file.close(); | ||
fs.chmodSync(destinationFilePath, 0755); | ||
return resolve(destinationFilePath); | ||
}); | ||
response.pipe(file); | ||
break; | ||
case 301: | ||
case 302: | ||
case 303: | ||
const redirectUrl = response.headers.location; | ||
return this.downloadExecFile(redirectUrl, destinationFilePath); | ||
default: | ||
return reject(new Error("Unable to download file at " + url + ". Status code: " + response.statusCode)); | ||
} | ||
}); | ||
|
||
request.end(); | ||
|
||
request.on('error', function(err) { | ||
return reject(err); | ||
}); | ||
}); | ||
|
||
const getJsonFile = url => | ||
new Promise((resolve, reject) => { | ||
https.get(url, res => { | ||
let body = ""; | ||
res.on("data", chunk => { | ||
body += chunk; | ||
}) | ||
|
||
res.on("end", () => { | ||
const data = JSON.parse(body); | ||
return resolve(data); | ||
}); | ||
}).on("error", reject); | ||
}); | ||
|
||
module.exports = { | ||
downloadFile, | ||
getJsonFile, | ||
}; | ||
|
34 changes: 0 additions & 34 deletions
utils.js
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.