Skip to content

Commit f0042eb

Browse files
committedMay 30, 2020
Get rid of lodash
1 parent ab6770b commit f0042eb

File tree

4 files changed

+139
-170
lines changed

4 files changed

+139
-170
lines changed
 

‎.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ node_js:
33
- "8"
44
- "10"
55
- "12"
6-
7-
before_script:
8-
- (cd test_app && npm install ../)

‎package-lock.json

+119-140
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Package cross-platform binaries",
55
"main": "index.js",
66
"scripts": {
7-
"test": "(cd test_app && ./build_packages.sh) && mocha && eslint ."
7+
"test": "(cd test_app && ./build_packages.sh && npm install ../) && mocha && eslint ."
88
},
99
"repository": {
1010
"type": "git",
@@ -35,13 +35,12 @@
3535
"chai": "^4.2.0",
3636
"child-process-promise": "^2.2.1",
3737
"eslint": "^6.6.0",
38-
"http-server": "^0.11.1",
38+
"http-server": "^0.12.3",
3939
"mocha": "^6.2.2"
4040
},
4141
"dependencies": {
4242
"mustache": "^3.1.0",
4343
"request": "^2.88.0",
44-
"request-promise": "^4.2.5",
4544
"tar": "^5.0.5",
4645
"unzip-stream": "^0.3.0"
4746
}

‎test.js

+18-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var request = require("request-promise");
1+
var request = require("request");
22

33
// https://nodejs.org/api/os.html#os_os_platform
44
var validPlatforms = {
@@ -29,7 +29,6 @@ var validArchs = {
2929

3030
module.exports = function test(config) {
3131
var errors = [];
32-
var checkedUrls = {};
3332

3433
var chain = Object.keys(config.urls).reduce(
3534
function(p, buildId) {
@@ -49,30 +48,25 @@ module.exports = function test(config) {
4948
if (url.slice(0,5) === "http:") {
5049
console.log("WARNING: Binary is published at an insecure URL (using https is recommended): " + displayUrl)
5150
}
52-
if (checkedUrls[url]) {
53-
return p.then(function() {
54-
console.log("OKAY: " + displayUrl);
55-
});
56-
} else {
57-
return p.then(function() {
58-
return request({
59-
method: "GET",
60-
uri: url,
61-
resolveWithFullResponse: true
62-
})
63-
.then(function(response) {
64-
if (response.statusCode != 200) {
65-
throw new Error("Status code " + response.statusCode);
66-
} else {
67-
console.log("OKAY: " + displayUrl);
68-
}
69-
})
70-
.catch(function(err) {
71-
console.error(" - Failed to fetch " + url + " " + err.message);
51+
52+
return p.then(function() {
53+
return new Promise(function(resolve) {
54+
request({ method: "GET", uri: url }, function(err, response) {
55+
if (err) {
56+
console.error(" - Failed to fetch " + url + ": " + err.message);
57+
errors.push(displayUrl);
58+
resolve();
59+
} else if (response.statusCode != 200) {
60+
console.error(" - Got non-200 response for " + url + ": " + response.statusCode);
7261
errors.push(displayUrl);
73-
});
62+
resolve();
63+
} else {
64+
console.log("OKAY: " + displayUrl);
65+
resolve();
66+
}
67+
});
7468
});
75-
}
69+
});
7670
},
7771
Promise.resolve()
7872
);

0 commit comments

Comments
 (0)
Please sign in to comment.