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.0 to 0.5.1

test.bat

6

CHANGELOG.md
# node-pre-gyp changelog
## 0.5.1
- Various minor bug fixes, several improving windows support for publishing.
## 0.5.0

@@ -31,3 +35,3 @@

- Fixed module path construction in tests.
- Added ability to disable falling back to build behavior via `npm install --fallback-to-buil=false` which overrides setting in a depedencies package.json `install` target.
- Added ability to disable falling back to build behavior via `npm install --fallback-to-build=false` which overrides setting in a depedencies package.json `install` target.

@@ -34,0 +38,0 @@ ## 0.3.0

4

lib/build.js

@@ -36,4 +36,4 @@

if (parts.length > 1) {
var key = parts[0]
opts[key] = parts[1];
var key = parts[0];
opts[key.slice(2)] = parts[1];
}

@@ -40,0 +40,0 @@ }

module.exports = exports = unpublish
exports.usage = 'Lists all published binaries'
exports.usage = 'Lists all published binaries (requires aws-sdk)'

@@ -13,6 +13,6 @@ var fs = require('fs')

, existsAsync = fs.exists || path.exists
, AWS = require("aws-sdk")
, config = require('rc')("node_pre_gyp",{acl:"public-read"});
function unpublish(gyp, argv, callback) {
var AWS = require("aws-sdk");
if(!config.accessKeyId || !config.secretAccessKey) {

@@ -19,0 +19,0 @@ return callback(new Error("Unknown S3 `accessKeyId` and `secretAccessKey`"));

module.exports = exports = publish
exports.usage = 'Publishes pre-built binary'
exports.usage = 'Publishes pre-built binary (requires aws-sdk)'

@@ -13,3 +13,2 @@ var fs = require('fs')

, existsAsync = fs.exists || path.exists
, AWS = require("aws-sdk")
, url = require('url')

@@ -19,2 +18,3 @@ , config = require('rc')("node_pre_gyp",{acl:"public-read"});

function publish(gyp, argv, callback) {
var AWS = require("aws-sdk");
if(!config.accessKeyId || !config.secretAccessKey) {

@@ -31,3 +31,3 @@ return callback(new Error("Unknown S3 `accessKeyId` and `secretAccessKey`"));

s3_setup.detect(opts.hosted_path,config);
var key_name = path.join(config.prefix,opts.package_name)
var key_name = url.resolve(config.prefix,opts.package_name)
AWS.config.update(config);

@@ -34,0 +34,0 @@ var s3 = new AWS.S3();

module.exports = exports = unpublish
exports.usage = 'Unpublishes pre-built binary'
exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)'

@@ -11,6 +11,7 @@ var fs = require('fs')

, s3_setup = require('./util/s3_setup.js')
, AWS = require("aws-sdk")
, url = require('url')
, config = require('rc')("node_pre_gyp",{acl:"public-read"});
function unpublish(gyp, argv, callback) {
var AWS = require("aws-sdk");
if(!config.accessKeyId || !config.secretAccessKey) {

@@ -23,3 +24,3 @@ return callback(new Error("Unknown S3 `accessKeyId` and `secretAccessKey`"));

AWS.config.update(config);
var key_name = path.join(config.prefix,opts.package_name)
var key_name = url.resolve(config.prefix,opts.package_name)
var s3 = new AWS.S3();

@@ -26,0 +27,0 @@ var s3_opts = { Bucket: config.bucket,

@@ -22,3 +22,5 @@

} else {
abi = abi_crosswalk[target].node_abi;
if (abi_crosswalk[target]) {
abi = abi_crosswalk[target].node_abi;
}
}

@@ -35,2 +37,5 @@ if (!abi) {

}
if (!abi_crosswalk[target]) {
throw new Error("Unsupported target version: " + target);
}
abi = abi_crosswalk[target].v8;

@@ -37,0 +42,0 @@ return 'v8-' + abi;

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

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

@@ -24,3 +24,3 @@ # node-pre-gyp

- Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost).
- Development is sponsered by [MapBox](https://www.mapbox.com/)
- Development is sponsored by [Mapbox](https://www.mapbox.com/)

@@ -84,3 +84,3 @@ ## Depends

This is guide to configuring your module to use node-pre-gyp.
This is a guide to configuring your module to use node-pre-gyp.

@@ -102,3 +102,3 @@ #### 1) Add new entries to your `package.json`

"install": "node-pre-gyp install --fallback-to-build",
}
},
"binary": {

@@ -111,2 +111,4 @@ "module_name": "your_module",

For a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/package.json#L11-L22).
##### The `binary` object has three required properties

@@ -138,8 +140,32 @@

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. 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`.
Note: This property supports variables based on [Versioning](#versioning).
#### 2) Dynamically require your `.node`
#### 2) Add a new target to binding.gyp
`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path).
A new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`.
Add a target like this at the end of your `targets` list:
```js
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
```
For a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp).
#### 3) Dynamically require your `.node`
Inside the main js file that requires your addon module you are likely currently doing:

@@ -161,3 +187,3 @@

var binary = require('node-pre-gyp');
var path = require('path')
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));

@@ -167,4 +193,6 @@ var binding = require(binding_path);

#### 3) Build and package your app
For a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4)
#### 4) Build and package your app
Now build your module from source:

@@ -178,7 +206,7 @@

#### 4) Test
#### 5) Test
Now `npm test` should work just as it did before.
#### 5) Publish the tarball
#### 6) Publish the tarball

@@ -205,7 +233,7 @@ Then package your app:

#### 6) Automate builds
#### 7) Automate builds
Now you need to publish builds for all the platforms and node versions you wish to support. This is best automated. See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux. On windows consider using a script [like this](https://github.com/mapbox/node-sqlite3/blob/master/scripts/build.bat) to quickly create and publish binaries and check out <https://appveyor.com>.
#### 7) You're done!
#### 8) You're done!

@@ -229,7 +257,7 @@ Now publish your package to the npm registry. Users will now be able to install your module from a binary.

**1) Create an S3 bucket**
#### 1) Create an S3 bucket
And have your key and secret key ready for writing to the bucket.
And have your **key** and **secret key** ready for writing to the bucket.
**2) Install node-pre-gyp**
#### 2) Install node-pre-gyp

@@ -244,3 +272,3 @@ Either install it globally:

**3) Create an `~/.node_pre_gyprc`**
#### 3) Create `~/.node_pre_gyprc`

@@ -265,3 +293,3 @@ Or pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards)

**4) Package and publish your build**
#### 4) Package and publish your build

@@ -281,7 +309,11 @@ node-pre-gyp package publish

**1) Install the travis gem**
For an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml).
Below is a guide to getting set up:
#### 1) Install the travis gem
gem install travis
**2) Create secure `global` variables**
#### 2) Create secure `global` variables

@@ -306,3 +338,3 @@ Make sure you run this command from within the directory of your module.

**3) Hook up publishing**
#### 3) Hook up publishing

@@ -317,3 +349,3 @@ Just put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`.

Perhaps keep that change in a different git branch and sync that when you want binaries published.
Keep that change in a different git branch and sync that when you want binaries published. This little hack will hopefully become obsolete when [travis adds proper support for different operating systems](https://github.com/travis-ci/travis-ci/issues/216).

@@ -345,8 +377,8 @@ Note: using `language: objective-c` instead of `language: nodejs` looses node.js specific travis sugar like a matrix for multiple node.js versions.

**4) Publish when you want**
#### 4) Publish when you want
You might wish to publish binaries only on a specific commit. To do this you could borrow from the [travis.ci idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish]`:
You might wish to publish binaries only on a specific commit. To do this you could borrow from the [travis.ci idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:
COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
if test "${COMMIT_MESSAGE#*'[publish]'}" != "$COMMIT_MESSAGE"; then node-pre-gyp publish; fi;
if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then node-pre-gyp publish; fi;

@@ -353,0 +385,0 @@ Or you could automatically detect if the git branch is a tag:

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