node-pre-gyp
Advanced tools
Comparing version 0.5.31 to 0.6.0
# node-pre-gyp changelog | ||
## 0.6.0 | ||
- BREAKING: node odd releases like v0.11.x now use `major.minor.patch` for `{node_abi}` instead of `NODE_MODULE_VERSION` (#124) | ||
- Added support for `toolset` option in versioning. By default is an empty string but `--toolset` can be passed to publish or install to select alternative binaries that target a custom toolset like C++11. For example to target Visual Studio 2014 modules like node-sqlite3 use `--toolset=v140`. | ||
- Added support for `--no-rollback` option to request that a failed binary test does not remove the binary module leaves it in place. | ||
- Added support for `--update-binary` option to request an existing binary be re-installed and the check for a valid local module be skipped. | ||
- Added support for passing build options from `npm` through `node-pre-gyp` to `node-gyp`: `--nodedir`, `--disturl`, `--python`, and `--msvs_version` | ||
## 0.5.31 | ||
@@ -4,0 +12,0 @@ |
@@ -40,3 +40,12 @@ | ||
} | ||
}) | ||
}); | ||
var known_gyp_args = ['dist-url','python','nodedir','msvs_version']; | ||
// in addition, pass along known node-gyp options | ||
known_gyp_args.forEach(function(arg) { | ||
var val = gyp.opts[arg] || gyp.opts[arg.replace('-','_')]; | ||
if (val) { | ||
opts[arg] = val; | ||
} | ||
}); | ||
var command_line_args = []; | ||
@@ -43,0 +52,0 @@ // turn back into command line options |
@@ -117,3 +117,5 @@ | ||
var source_build = gyp.opts['build-from-source'] || gyp.opts['build_from_source']; | ||
var update_binary = gyp.opts['update-binary'] || gyp.opts['update_binary']; | ||
var should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true'); | ||
var no_rollback = gyp.opts.hasOwnProperty('rollback') && gyp.opts['rollback'] === false; | ||
if (should_do_source_build) { | ||
@@ -143,3 +145,3 @@ log.info('build','requesting source compile'); | ||
if (existsAsync(binary_module,function(found) { | ||
if (found) { | ||
if (found && !update_binary) { | ||
testbinary(gyp, argv, function(err) { | ||
@@ -164,3 +166,3 @@ if (err) { | ||
console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed'); | ||
console.log('Pass --build-from-source to recompile'); | ||
console.log('Pass --update-binary to reinstall or --build-from-source to recompile'); | ||
return callback(); | ||
@@ -170,3 +172,3 @@ } | ||
} else { | ||
log.info('check','checked for "' + binary_module + '" (not found)') | ||
if (!update_binary) log.info('check','checked for "' + binary_module + '" (not found)') | ||
place_binary(from,to,opts,function(err) { | ||
@@ -181,2 +183,5 @@ if (err && should_do_fallback_build) { | ||
if (err) { | ||
if (no_rollback) { | ||
return callback(err); | ||
} | ||
gyp.opts.silent_clean = true; | ||
@@ -183,0 +188,0 @@ clean(gyp, argv, function(error) { |
@@ -25,4 +25,6 @@ | ||
} | ||
log.info('publish', 'Detecting s3 credentials'); | ||
s3_setup.detect(opts.hosted_path,config); | ||
var key_name = url.resolve(config.prefix,opts.package_name) | ||
log.info('publish', 'Authenticating with s3'); | ||
AWS.config.update(config); | ||
@@ -33,8 +35,12 @@ var s3 = new AWS.S3(); | ||
}; | ||
var remote_package = 'https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key; | ||
log.info('publish', 'Checking for existing binary at ' + remote_package); | ||
s3.headObject(s3_opts, function(err, meta){ | ||
if (meta) log.info('publish', JSON.stringify(meta)); | ||
if (err && err.code == 'NotFound') { | ||
// we are safe to publish because | ||
// the object does not already exist | ||
var s3 = new AWS.S3(); | ||
var s3_obj_opts = { ACL: config.acl, | ||
log.info('publish', 'Preparing to put object'); | ||
var s3_put = new AWS.S3(); | ||
var s3_put_opts = { ACL: config.acl, | ||
Body: fs.createReadStream(tarball), | ||
@@ -44,8 +50,21 @@ Bucket: config.bucket, | ||
}; | ||
s3.putObject(s3_obj_opts, function(err, resp){ | ||
if(err) return callback(err); | ||
console.log('['+package_json.name+'] Success: published to https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); | ||
return callback(); | ||
}); | ||
} else if(err) { | ||
log.info('publish', 'Putting object'); | ||
try { | ||
s3_put.putObject(s3_put_opts, function(err, resp){ | ||
log.info('publish', 'returned from putting object'); | ||
if(err) { | ||
log.info('publish', 's3 putObject error: "' + err + '"'); | ||
return callback(err); | ||
} | ||
if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"'); | ||
log.info('publish', 'successfully put object'); | ||
console.log('['+package_json.name+'] published to ' + remote_package); | ||
return callback(); | ||
}); | ||
} catch (err) { | ||
log.info('publish', 's3 putObject error: "' + err + '"'); | ||
return callback(err); | ||
} | ||
} else if (err) { | ||
log.info('publish', 's3 headObject error: "' + err + '"'); | ||
return callback(err); | ||
@@ -57,3 +76,3 @@ } else { | ||
log.error('publish','\t node-pre-gyp unpublish'); | ||
return callback(new Error('Failed publishing to https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key)); | ||
return callback(new Error('Failed publishing to ' + remote_package)); | ||
} | ||
@@ -60,0 +79,0 @@ }); |
@@ -24,4 +24,4 @@ | ||
if (find_val && opts.hasOwnProperty(find_val)) { | ||
console.log(opts[find_val].replace(/\\/g, '/')); | ||
hit = true; | ||
console.log(opts[find_val].replace(/\\/g, '/')); | ||
hit = true; | ||
} | ||
@@ -28,0 +28,0 @@ // otherwise return all options as json |
@@ -32,3 +32,3 @@ | ||
} else { | ||
log.info(JSON.stringify(meta)); | ||
log.info('unpublish', JSON.stringify(meta)); | ||
s3.deleteObject(s3_opts, function(err, resp) { | ||
@@ -35,0 +35,0 @@ if (err) return callback(err); |
{ | ||
"0.6.3": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.4": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.5": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.6": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.7": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.8": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.9": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.10": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.11": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.12": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.13": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.14": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.15": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.16": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.17": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.18": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.19": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.20": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.6.21": { | ||
"node_abi": 1, | ||
"v8": "3.6" | ||
}, | ||
"0.7.0": { | ||
"node_abi": 1, | ||
"v8": "3.8" | ||
}, | ||
"0.7.1": { | ||
"node_abi": 1, | ||
"v8": "3.8" | ||
}, | ||
"0.7.2": { | ||
"node_abi": 1, | ||
"v8": "3.8" | ||
}, | ||
"0.7.3": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.4": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.5": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.6": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.7": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.8": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.9": { | ||
"node_abi": 1, | ||
"v8": "3.11" | ||
}, | ||
"0.7.10": { | ||
"node_abi": 1, | ||
"v8": "3.9" | ||
}, | ||
"0.7.11": { | ||
"node_abi": 1, | ||
"v8": "3.11" | ||
}, | ||
"0.7.12": { | ||
"node_abi": 1, | ||
"v8": "3.11" | ||
}, | ||
"0.8.0": { | ||
@@ -238,54 +110,10 @@ "node_abi": 1, | ||
}, | ||
"0.9.0": { | ||
"0.8.27": { | ||
"node_abi": 1, | ||
"v8": "3.11" | ||
}, | ||
"0.9.1": { | ||
"node_abi": 10, | ||
"0.8.28": { | ||
"node_abi": 1, | ||
"v8": "3.11" | ||
}, | ||
"0.9.2": { | ||
"node_abi": 10, | ||
"v8": "3.11" | ||
}, | ||
"0.9.3": { | ||
"node_abi": 10, | ||
"v8": "3.13" | ||
}, | ||
"0.9.4": { | ||
"node_abi": 10, | ||
"v8": "3.13" | ||
}, | ||
"0.9.5": { | ||
"node_abi": 10, | ||
"v8": "3.13" | ||
}, | ||
"0.9.6": { | ||
"node_abi": 10, | ||
"v8": "3.15" | ||
}, | ||
"0.9.7": { | ||
"node_abi": 10, | ||
"v8": "3.15" | ||
}, | ||
"0.9.8": { | ||
"node_abi": 10, | ||
"v8": "3.15" | ||
}, | ||
"0.9.9": { | ||
"node_abi": 11, | ||
"v8": "3.15" | ||
}, | ||
"0.9.10": { | ||
"node_abi": 11, | ||
"v8": "3.15" | ||
}, | ||
"0.9.11": { | ||
"node_abi": 11, | ||
"v8": "3.14" | ||
}, | ||
"0.9.12": { | ||
"node_abi": 11, | ||
"v8": "3.14" | ||
}, | ||
"0.10.0": { | ||
@@ -292,0 +120,0 @@ "node_abi": 11, |
@@ -67,3 +67,3 @@ | ||
var final_args = cmd_args.concat(args); | ||
var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]}); | ||
var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, stdio: [ 0, 1, 2]}); | ||
cmd.on('error', function (err) { | ||
@@ -70,0 +70,0 @@ if (err) { |
@@ -9,13 +9,54 @@ module.exports = exports; | ||
function get_node_abi(runtime, target) { | ||
if (target) { | ||
// abi_crosswalk generated with ./scripts/abi_crosswalk.js | ||
var abi = ''; | ||
if (runtime === 'node-webkit') { | ||
return runtime + '-v' + target; | ||
function get_node_webkit_abi(runtime, target_version) { | ||
if (!runtime) { | ||
throw new Error("get_node_webkit_abi requires valid runtime arg"); | ||
} | ||
if (typeof target_version === 'undefined') { | ||
// erroneous CLI call | ||
throw new Error("Empty target version is not supported if node-webkit is the target."); | ||
} | ||
return runtime + '-v' + target_version; | ||
} | ||
module.exports.get_node_webkit_abi = get_node_webkit_abi; | ||
function get_node_abi(runtime, versions) { | ||
if (!runtime) { | ||
throw new Error("get_node_abi requires valid runtime arg"); | ||
} | ||
if (!versions) { | ||
throw new Error("get_node_abi requires valid process.versions object"); | ||
} | ||
var sem_ver = semver.parse(versions.node); | ||
if (sem_ver.major === 0 && sem_ver.minor % 2) { // odd series | ||
// https://github.com/mapbox/node-pre-gyp/issues/124 | ||
return runtime+'-v'+versions.node; | ||
} else { | ||
// process.versions.modules added in >= v0.10.4 and v0.11.7 | ||
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e | ||
return versions.modules ? runtime+'-v' + (+versions.modules) : | ||
'v8-' + versions.v8.split('.').slice(0,2).join('.'); | ||
} | ||
} | ||
module.exports.get_node_abi = get_node_abi; | ||
function get_runtime_abi(runtime, target_version) { | ||
if (!runtime) { | ||
throw new Error("get_runtime_abi requires valid runtime arg"); | ||
} | ||
if (runtime === 'node-webkit') { | ||
var target_version = target_version || process.versions['node-webkit']; | ||
return get_node_webkit_abi(runtime, target_version); | ||
} else { | ||
if (runtime != 'node') { | ||
throw new Error("Unknown Runtime: '" + runtime + "'"); | ||
} | ||
if (!target_version) { | ||
return get_node_abi(runtime,process.versions); | ||
} else { | ||
if (abi_crosswalk[target]) { | ||
abi = abi_crosswalk[target].node_abi; | ||
var cross_obj; | ||
// abi_crosswalk generated with ./scripts/abi_crosswalk.js | ||
if (abi_crosswalk[target_version]) { | ||
cross_obj = abi_crosswalk[target_version]; | ||
} else { | ||
var target_parts = target.split('.').map(function(i) { return +i }); | ||
var target_parts = target_version.split('.').map(function(i) { return +i }); | ||
if (target_parts.length == 3 && (target_parts[1] % 2 == 0)) { | ||
@@ -26,3 +67,3 @@ var patch = target_parts[2]; | ||
if (abi_crosswalk[new_target]) { | ||
abi = abi_crosswalk[new_target].node_abi; | ||
cross_obj = abi_crosswalk[target_version]; | ||
break; | ||
@@ -33,33 +74,18 @@ } | ||
} | ||
} | ||
if (!abi) { | ||
throw new Error("Unsupported target version: " + target); | ||
} | ||
if (abi > 1) { | ||
return runtime+'-v' + (+abi); | ||
} else { | ||
// no support for node-webkit unless > 0.10.x | ||
if (runtime != 'node') { | ||
throw new Error("Runtime '" + runtime + "' unsupported for target version: " + target); | ||
if (!cross_obj) { | ||
throw new Error("Unsupported target version: " + target_version); | ||
} | ||
if (!abi_crosswalk[target]) { | ||
throw new Error("Unsupported target version: " + target); | ||
// emulate process.versions | ||
var versions_obj = { | ||
node: target_version, | ||
v8: cross_obj.v8+'.0', | ||
// abi_crosswalk uses 1 for node versions lacking process.versions.modules | ||
// process.versions.modules added in >= v0.10.4 and v0.11.7 | ||
modules: cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined | ||
} | ||
abi = abi_crosswalk[target].v8; | ||
return 'v8-' + abi; | ||
return get_node_abi(runtime, versions_obj); | ||
} | ||
} else { | ||
if (runtime === 'node-webkit') { | ||
if (typeof process.versions['node-webkit'] === 'undefined') { | ||
// erroneous CLI call | ||
throw new Error("Empty target version is not supported if node-webkit is the target."); | ||
} | ||
return runtime + '-v' + process.versions['node-webkit']; | ||
} | ||
// process.versions.modules added in >= v0.10.4 and v0.11.7 | ||
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e | ||
return process.versions.modules ? runtime+'-v' + (+process.versions.modules) : | ||
'v8-' + process.versions.v8.split('.').slice(0,2).join('.'); | ||
} | ||
} | ||
module.exports.get_runtime_abi = get_runtime_abi; | ||
@@ -78,2 +104,5 @@ var required_parameters = [ | ||
} | ||
if (!package_json.version) { | ||
missing.push('version'); | ||
} | ||
if (!package_json.name) { | ||
@@ -122,3 +151,3 @@ missing.push('name'); | ||
// and a lacking slash may not lead to proper joining | ||
function add_trailing_slash(pathname) { | ||
function fix_slashes(pathname) { | ||
if (pathname.slice(-1) != '/') { | ||
@@ -130,2 +159,9 @@ return pathname + '/'; | ||
// remove double slashes | ||
// note: path.normalize will not work because | ||
// it will convert forward to back slashes | ||
function drop_double_slashes(pathname) { | ||
return pathname.replace(/\/\//g,'/'); | ||
} | ||
var default_package_name = '{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz'; | ||
@@ -147,3 +183,3 @@ var default_remote_path = ''; | ||
, prerelease: module_version.prerelease.length ? module_version.prerelease.join('.') : '' | ||
, build :module_version.build.length ? module_version.build.join('.') : '' | ||
, build: module_version.build.length ? module_version.build.join('.') : '' | ||
, major: module_version.major | ||
@@ -153,3 +189,3 @@ , minor: module_version.minor | ||
, runtime: runtime | ||
, node_abi: get_node_abi(runtime,options.target) | ||
, node_abi: get_runtime_abi(runtime,options.target) | ||
, target: options.target || '' | ||
@@ -161,4 +197,5 @@ , platform: options.target_platform || process.platform | ||
, module_main: package_json.main | ||
, toolset : options.toolset || '' // address https://github.com/mapbox/node-pre-gyp/issues/119 | ||
} | ||
opts.host = add_trailing_slash(eval_template(package_json.binary.host,opts)); | ||
opts.host = fix_slashes(eval_template(package_json.binary.host,opts)); | ||
opts.module_path = eval_template(package_json.binary.module_path,opts); | ||
@@ -174,3 +211,3 @@ // now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably | ||
opts.module = path.join(opts.module_path,opts.module_name + '.node') | ||
opts.remote_path = package_json.binary.remote_path ? add_trailing_slash(eval_template(package_json.binary.remote_path,opts)) : default_remote_path; | ||
opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path,opts))) : default_remote_path; | ||
var package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name; | ||
@@ -177,0 +214,0 @@ opts.package_name = eval_template(package_name,opts); |
{ | ||
"name": "node-pre-gyp", | ||
"description": "Node.js native addon binary install tool", | ||
"version" : "0.5.31", | ||
"version" : "0.6.0", | ||
"keywords": [ | ||
@@ -27,3 +27,3 @@ "native", | ||
"semver": "~4.1.0", | ||
"tar": "~1.0.1", | ||
"tar": "~1.0.2", | ||
"tar-pack":"~2.0.0", | ||
@@ -30,0 +30,0 @@ "mkdirp":"~0.5.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3056279
58571
Updatedtar@~1.0.2