From 5278cbe3a8fe7ae21956a692101efa3b090879d5 Mon Sep 17 00:00:00 2001 From: Tim Coulter Date: Tue, 22 Aug 2017 14:04:59 -0700 Subject: [PATCH 1/5] Ignore package-lock.json for now. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3c3629e..f846c68 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules +package-lock.json +yarn.lock From 9822316e95a01102f76c25a029973d58e575a748 Mon Sep 17 00:00:00 2001 From: Micah Riggan Date: Thu, 5 Oct 2017 11:05:30 -0500 Subject: [PATCH 2/5] switching to request library that respects env variable --- lib/utils/unbox.js | 6 ++---- package.json | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/utils/unbox.js b/lib/utils/unbox.js index 23c2521..b12d29b 100644 --- a/lib/utils/unbox.js +++ b/lib/utils/unbox.js @@ -1,7 +1,7 @@ var fs = require("fs-extra"); var path = require("path"); var ghdownload = require('github-download'); -var https = require("https"); +var request = require('request'); var vcsurl = require('vcsurl'); var parseURL = require('url').parse; var tmp = require('tmp'); @@ -38,7 +38,7 @@ function verifyURL(url) { host: configURL.host, path: configURL.path }; - var req = https.request(options, function(r) { + request(options, function(error, r) { if (r.statusCode == 404) { return reject(new Error("Truffle Box at URL " + url + " doesn't exist. If you believe this is an error, please contact Truffle support.")); } else if (r.statusCode != 200) { @@ -46,8 +46,6 @@ function verifyURL(url) { } accept(); }); - req.end(); - }); } diff --git a/package.json b/package.json index f2de6e0..b32c8cd 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "dependencies": { "fs-extra": "^3.0.1", "github-download": "^0.5.0", + "request": "^2.83.0", "tmp": "^0.0.31", "vcsurl": "^0.1.1" } From 8bc7f1abb5af517d827608465dbc39f6a7ab43d9 Mon Sep 17 00:00:00 2001 From: Micah Riggan Date: Thu, 5 Oct 2017 11:18:19 -0500 Subject: [PATCH 3/5] Adding https --- lib/utils/unbox.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utils/unbox.js b/lib/utils/unbox.js index b12d29b..7c6dc48 100644 --- a/lib/utils/unbox.js +++ b/lib/utils/unbox.js @@ -35,8 +35,7 @@ function verifyURL(url) { var options = { method: 'HEAD', - host: configURL.host, - path: configURL.path + uri: 'https://' + configURL.host + configURL.path }; request(options, function(error, r) { if (r.statusCode == 404) { From f3661b18cc1c13101bc229090a4dd0f7bf685e0b Mon Sep 17 00:00:00 2001 From: Micah Riggan Date: Thu, 5 Oct 2017 13:01:40 -0500 Subject: [PATCH 4/5] adding catch for error --- lib/utils/unbox.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/unbox.js b/lib/utils/unbox.js index 7c6dc48..c8662ea 100644 --- a/lib/utils/unbox.js +++ b/lib/utils/unbox.js @@ -38,7 +38,9 @@ function verifyURL(url) { uri: 'https://' + configURL.host + configURL.path }; request(options, function(error, r) { - if (r.statusCode == 404) { + if (error) { + return reject(new Error("Error making request. Please check the format of the requested resource: " + options.uri)); + } else if (r.statusCode == 404) { return reject(new Error("Truffle Box at URL " + url + " doesn't exist. If you believe this is an error, please contact Truffle support.")); } else if (r.statusCode != 200) { return reject(new Error("Error connecting to github.com. Please check your internet connection and try again.")); From 3dfdc5eaaa50af6e8706d75e4c9d10a552ee4321 Mon Sep 17 00:00:00 2001 From: "g. nicholas d'andrea" Date: Mon, 9 Oct 2017 17:33:44 -0400 Subject: [PATCH 5/5] Update version to 1.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b32c8cd..c3506a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "truffle-box", - "version": "1.0.2", + "version": "1.0.3", "description": "Truffle project boilerplate utility", "main": "box.js", "scripts": {