Socket
Socket
Sign inDemoInstall

node-pre-gyp

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-pre-gyp - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

4

CHANGELOG.md
# node-pre-gyp changelog
## 0.5.4
- No longer depends on external install of node-gyp for compiling builds.
## 0.5.3

@@ -4,0 +8,0 @@

3

lib/node-pre-gyp.js

@@ -175,5 +175,2 @@

, ''
, ' for specific command usage and options try:'
, ' $ node-pre-gyp <command> --help'
, ''
, 'node-pre-gyp@' + this.version + ' ' + path.resolve(__dirname, '..')

@@ -180,0 +177,0 @@ , 'node@' + process.versions.node

@@ -13,18 +13,60 @@

, os = require('os')
, existsAsync = fs.exists || path.exists
, existsSync = fs.existsSync || path.existsSync
, cp = require('child_process')
// try to build up the complete path to node-gyp
/* priority:
- node-gyp on NODE_PATH
- node-gyp inside npm on NODE_PATH
- node-gyp inside npm beside node exe
*/
function which_node_gyp() {
try {
var node_gyp_main = require.resolve('node-gyp');
var node_gyp_bin = path.join(path.dirname(
path.dirname(node_gyp_main))
,'bin/node-gyp.js');
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
} catch (err) { }
try {
var npm_main = require.resolve('npm');
var node_gyp_bin = path.join(path.dirname(
path.dirname(npm_main))
,'node_modules/node-gyp/bin/node-gyp.js');
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
} catch (err) { }
var npm_base = path.join(path.dirname(
path.dirname(process.execPath))
,'lib/node_modules/npm/')
var node_gyp_bin = path.join(npm_base,'node_modules/node-gyp/bin/node-gyp.js');
if (existsSync(node_gyp_bin)) {
return node_gyp_bin;
}
}
module.exports.run_gyp = function(args,opts,callback) {
var shell_cmd = 'node-gyp';
var shell_cmd = '';
var cmd_args = [];
if (opts.runtime && opts.runtime == 'node-webkit') {
shell_cmd = 'nw-gyp';
if (win) shell_cmd += '.cmd';
} else {
var node_gyp_path = which_node_gyp();
if (node_gyp_path) {
shell_cmd = process.execPath;
cmd_args.push(node_gyp_path);
} else {
shell_cmd = 'node-gyp';
if (win) shell_cmd += '.cmd';
}
}
if (win) {
shell_cmd += '.cmd';
}
var cmd = cp.spawn(shell_cmd, args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]});
var final_args = cmd_args.concat(args);
var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]});
cmd.on('error', function (err) {
if (err) {
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + args.join(' ') + "' (" + err + ")"));
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ")"));
}

@@ -31,0 +73,0 @@ callback(null,opts);

{
"name": "node-pre-gyp",
"description": "Node.js native addon binary install tool",
"version": "0.5.3",
"version": "0.5.4",
"keywords": [

@@ -6,0 +6,0 @@ "native",

@@ -69,2 +69,3 @@ # node-pre-gyp

- `--build-from-source`: build from source instead of using pre-built binary
- `--runtime=node-webkit`: customize the runtime: `node` and `node-webkit` are the valid options
- `--fallback-to-build`: fallback to building from source if pre-built binary is not available

@@ -137,3 +138,3 @@ - `--target=0.10.25`: Pass the target node or node-webkit version to compile against

It is **not recommended** to override this property. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path`. If you do not provide it in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which is a versioning string capable of supporting any remove lookup of your modules across all of its pubished versions and various node versions, platforms and architectures. But if you only wish to support windows you could could change it to `{module_name}-v{version}-{node_abi}-win32-{arch}.tar.gz`.
It is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`.

@@ -254,2 +255,27 @@ Note: This property supports variables based on [Versioning](#versioning).

It is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like:
```js
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1394587197000",
"Effect": "Allow",
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::node-pre-gyp-tests/*"
]
}
]
}
```
#### 2) Install node-pre-gyp

@@ -287,2 +313,8 @@

Install the `aws-sdk`:
npm install aws-sdk
Then publish:
node-pre-gyp package publish

@@ -292,2 +324,3 @@

## Travis Automation

@@ -294,0 +327,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc