Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const existsAsync = fs.exists || path.exists;
const versioning = require('./util/versioning.js');
const napi = require('./util/napi.js');
const s3_setup = require('./util/s3_setup.js');
const url = require('url');
// for fetching binaries
const fetch = require('node-fetch');
const tar = require('tar');
Expand All @@ -38,7 +37,7 @@ function place_binary_authenticated(opts, targetDir, callback) {
try {
const config = s3_setup.detect(opts);
const s3 = s3_setup.get_s3(config);
const key_name = url.resolve(config.prefix, opts.package_name);
const key_name = path.posix.join(config.prefix, opts.package_name);

log.info('install', 'Downloading from S3:', config.bucket, key_name);

Expand Down
3 changes: 1 addition & 2 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const versioning = require('./util/versioning.js');
const napi = require('./util/napi.js');
const s3_setup = require('./util/s3_setup.js');
const existsAsync = fs.exists || path.exists;
const url = require('url');

function publish(gyp, argv, callback) {
const package_json = gyp.package_json;
Expand All @@ -27,7 +26,7 @@ function publish(gyp, argv, callback) {
const config = s3_setup.detect(opts);
const s3 = s3_setup.get_s3(config);

const key_name = url.resolve(config.prefix, opts.package_name);
const key_name = path.posix.join(config.prefix, opts.package_name);
const s3_opts = {
Bucket: config.bucket,
Key: key_name
Expand Down
4 changes: 2 additions & 2 deletions lib/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const log = require('./util/log.js');
const versioning = require('./util/versioning.js');
const napi = require('./util/napi.js');
const s3_setup = require('./util/s3_setup.js');
const url = require('url');
const path = require('path');

function unpublish(gyp, argv, callback) {
const package_json = gyp.package_json;
const napi_build_version = napi.get_napi_build_version_from_command_args(argv);
const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
const config = s3_setup.detect(opts);
const s3 = s3_setup.get_s3(config);
const key_name = url.resolve(config.prefix, opts.package_name);
const key_name = path.posix.join(config.prefix, opts.package_name);
const s3_opts = {
Bucket: config.bucket,
Key: key_name
Expand Down
4 changes: 1 addition & 3 deletions lib/util/s3_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

module.exports = exports;

const url = require('url');

module.exports.detect = function(opts) {
const config = {};

const to = opts.hosted_path;
const uri = url.parse(to);
const uri = new URL(to);

if (opts.bucket && opts.region) {
// use user defined settings for host, region, bucket
Expand Down
9 changes: 4 additions & 5 deletions lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = exports;

const path = require('path');
const semver = require('semver');
const url = require('url');
const detect_libc = require('detect-libc');
const napi = require('./napi.js');

Expand Down Expand Up @@ -221,7 +220,7 @@ function validate_config(package_json, opts) {
}
if (o) {
// enforce https over http
const protocol = url.parse(o.host).protocol;
const protocol = new URL(o.host).protocol;
if (protocol === 'http:') {
throw new Error("'host' protocol (" + protocol + ") is invalid - only 'https:' is accepted");
}
Expand Down Expand Up @@ -333,10 +332,10 @@ module.exports.evaluate = function(package_json, options, napi_build_version) {
// when using s3ForcePathStyle the bucket is part of the http object path
// add it
if (opts.s3ForcePathStyle) {
opts.hosted_path = url.resolve(opts.host, drop_double_slashes(`${opts.bucket}/${opts.remote_path}`));
opts.hosted_path = new URL(drop_double_slashes(`${opts.bucket}/${opts.remote_path}`), opts.host).href;
} else {
opts.hosted_path = url.resolve(opts.host, opts.remote_path);
opts.hosted_path = new URL(opts.remote_path, opts.host).href;
}
opts.hosted_tarball = url.resolve(opts.hosted_path, opts.package_name);
opts.hosted_tarball = new URL(opts.package_name, opts.hosted_path).href;
return opts;
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mapbox/node-pre-gyp",
"name": "@yrambler2001/node-pre-gyp",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?!?

"description": "Node.js native addon binary install tool",
"version": "2.0.4-pre.0",
"version": "2.0.4",
"keywords": [
"native",
"addon",
Expand Down
Loading