Skip to content

Commit

Permalink
Add proxy support for Node.js 10 and above (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore authored and SBoudrias committed Jul 1, 2019
1 parent f0a5c51 commit e009e3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
require('.')();

// Override http networking to go through a proxy if one is configured.
require('global-tunnel-ng').initialize();
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);

if (MAJOR_NODEJS_VERSION >= 10) {
// `global-agent` works with Node.js v10 and above.
require('global-agent').bootstrap();
} else {
// `global-tunnel-ng` works only with Node.js v10 and below.
require('global-tunnel-ng').initialize();
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"ansi-styles": "^3.2.0",
"bin-version-check": "^3.0.0",
"chalk": "^2.3.0",
"global-agent": "^2.0.0",
"global-tunnel-ng": "^2.5.3",
"latest-version": "^3.1.0",
"log-symbols": "^2.1.0",
Expand Down

0 comments on commit e009e3d

Please sign in to comment.