node-pre-gyp
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -80,3 +80,6 @@ #!/usr/bin/env node | ||
} | ||
console.log.apply(console, [].slice.call(arguments, 1)) | ||
var args_array = [].slice.call(arguments, 1) | ||
if (args_array.length) { | ||
console.log.apply(console, args_array) | ||
} | ||
// now run the next command in the queue | ||
@@ -83,0 +86,0 @@ process.nextTick(run) |
@@ -21,3 +21,3 @@ | ||
'rebuild', | ||
'publish' | ||
'package' | ||
] | ||
@@ -24,0 +24,0 @@ , aliases = { |
@@ -122,4 +122,3 @@ | ||
badDownload = true | ||
callback(new Error(res.statusCode + ' status code downloading tarball')) | ||
return | ||
return callback(new Error(res.statusCode + ' status code downloading tarball')) | ||
} | ||
@@ -135,36 +134,48 @@ // start unzipping and untaring | ||
var package_json = JSON.parse(fs.readFileSync('./package.json')); | ||
if (gyp.opts['build_from_source'] && ( | ||
(gyp.opts['build_from_source'] === true || gyp.opts['build_from_source'] === 'true') || | ||
(gyp.opts['build_from_source'] === package_json.name))) { | ||
// @TODO = if run via npm dashes will become underscore - why? | ||
var command_line_opts = (typeof(gyp.opts.argv.original) === 'string') ? JSON.parse(gyp.opts.argv).original : gyp.opts.argv.original || []; | ||
command_line_opts = command_line_opts.filter(function(opt) { return opt.length > 2 && opt.slice(0,2) == '--'}); | ||
var node_gyp_args = ['rebuild'].concat(command_line_opts); | ||
var source_build = gyp.opts['build-from-source'] || gyp.opts['build_from_source']; | ||
if (source_build === package_json.name || | ||
source_build === true || | ||
source_build === 'true') { | ||
log.info('rebuild','requesting source compile'); | ||
return compile.run_gyp(['rebuild'],gyp.opts,callback); | ||
compile.run_gyp(node_gyp_args,gyp.opts,function(err,opts) { | ||
return callback(err); | ||
}); | ||
} else { | ||
versioning.evaluate(package_json, gyp.opts, function(err,opts) { | ||
if (err) return callback(err); | ||
var from = package_json.binary.remote_uri + '/' + opts.versioned; | ||
var to = package_json.binary.module_path; | ||
var binary_module = path.join(to,opts.module_name + '.node'); | ||
if (existsAsync(binary_module,function(found) { | ||
if (found) { | ||
console.log('['+package_json.name+'] Success: "' + binary_module + '" is already installed'); | ||
return callback(); | ||
} else { | ||
place_binary(from,to,opts,function(err) { | ||
if (err) { | ||
log.info('build','source compile required'); | ||
compile.run_gyp(node_gyp_args,opts,function(err,opts) { | ||
return callback(err); | ||
}); | ||
} else { | ||
test_binary(opts,function(err) { | ||
if (err) { | ||
log.info("Testing pre-built binary failed, falling back to source compile: ("+err.message+")"); | ||
compile.run_gyp(node_gyp_args,opts,function(err,opts) { | ||
return callback(err); | ||
}); | ||
} | ||
console.log('['+package_json.name+'] Success: "' + binary_module + '" is installed'); | ||
return callback(); | ||
}); | ||
}; | ||
}); | ||
} | ||
})); | ||
}); | ||
} | ||
versioning.evaluate(package_json, gyp.opts, function(err,opts) { | ||
if (err) return callback(err); | ||
var from = package_json.binary.remote_uri + '/' + opts.versioned; | ||
var to = package_json.binary.module_path; | ||
var binary_module = path.join(to,opts.module_name+'.node'); | ||
if (existsAsync(binary_module,function(found) { | ||
if (found) { | ||
log.info('install','Sweet: "'+binary_module+'" is installed!'); | ||
callback(); | ||
} else { | ||
place_binary(from,to,opts,function(err) { | ||
if (err) { | ||
log.info('build','source compile required'); | ||
compile.run_gyp(['rebuild'],opts,callback); | ||
} else { | ||
test_binary(opts,function(err) { | ||
if (err) { | ||
log.info("Testing pre-built binary failed, falling back to source compile: ("+err.message+")"); | ||
compile.run_gyp(['rebuild'],opts,callback); | ||
} | ||
log.info('rebuild','Sweet: "'+binary_module+'" was successfully built!'); | ||
return callback(); | ||
}); | ||
}; | ||
}); | ||
} | ||
})); | ||
}); | ||
} |
@@ -22,3 +22,3 @@ | ||
} | ||
var cmd = cp.spawn(shell_cmd,args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]}); | ||
var cmd = cp.spawn(shell_cmd, args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]}); | ||
cmd.on('error', function (err) { | ||
@@ -25,0 +25,0 @@ if (err) { |
{ | ||
"name": "node-pre-gyp", | ||
"description": "Node.js native addon binary install tool", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"keywords": [ | ||
@@ -28,7 +28,11 @@ "native", | ||
"tar": "0", | ||
"tar-pack":"*" | ||
"tar-pack":"*", | ||
"mkdirp":"*" | ||
}, | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
}, | ||
"scripts": { | ||
"test":"./test.sh" | ||
} | ||
} |
@@ -12,2 +12,4 @@ # node-pre-gyp | ||
[![Build Status](https://secure.travis-ci.org/springmeyer/node-pre-gyp.png)](https://travis-ci.org/springmeyer/node-pre-gyp) | ||
# Design | ||
@@ -36,4 +38,3 @@ | ||
```js | ||
mkdir stage | ||
node-pre-gyp publish | ||
node-pre-gyp package | ||
``` | ||
@@ -40,0 +41,0 @@ |
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code which could be a vector to obscure malicious code, and generally decrease the likelihood of reproducible or reliable installs.
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
27106
22
595
57
7
2
1
7
+ Addedmkdirp@*
+ Addedmkdirp@3.0.1(transitive)