Skip to content

Commit 778be83

Browse files
author
Dane Springmeyer
committed
more readme fixes
1 parent abf923e commit 778be83

File tree

1 file changed

+53
-50
lines changed

1 file changed

+53
-50
lines changed

README.md

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99

1010
## Overview
1111

12-
To enable binary installs `node-pre-gyp` you set up `npm` to call `node-pre-gyp` to install a module which overrides the default `npm` behavior of calling `node-gyp` to build from source.
13-
14-
`node-pre-gyp` stands between `npm` and `node-gyp`. It offers two main things:
12+
`node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp). It offers two main things:
1513

1614
- A command line tool called `node-pre-gyp` that can install your package from a binary or publish it.
1715
- Javascript code that can be required to dynamically find your module: `require('node-pre-gyp').find`
1816

19-
For a hello world example of a Node.js C++ modules packaged with `node-pre-gyp` see <https://github.com/springmeyer/node-addon-example>.
17+
For a hello world example of a Node.js C++ module packaged with `node-pre-gyp` see <https://github.com/springmeyer/node-addon-example>.
2018

2119
## Modules using `node-pre-gyp`:
2220

@@ -28,43 +26,75 @@ For a hello world example of a Node.js C++ modules packaged with `node-pre-gyp`
2826

2927
For more examples see the [test apps](test/).
3028

29+
## Depends
30+
31+
- Node.js 0.10.x or 0.8.x
32+
33+
## Install
34+
35+
`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like:
36+
37+
./node_modules/.bin/node-pre-gyp --help
38+
39+
But you can also install it globally:
40+
41+
npm install node-pre-gyp -g
42+
3143
## Usage
3244

33-
**1) Add node-pre-gyp as a bundled dependency in `package.json`**
45+
### Commands
46+
47+
View all possible commands:
48+
49+
node-pre-gyp --help
50+
51+
- clean - Removes the entire folder containing the compiled .node module
52+
- install - Attempts to install pre-built binary for module
53+
- reinstall - Runs "clean" and "install" at once
54+
- build - Attempts to compile the module by dispatching to node-gyp or nw-gyp
55+
- rebuild - Runs "clean" and "build" at once
56+
- package - Packs binary into tarball
57+
- testpackage - Tests that the staged package is valid
58+
- publish - Publishes pre-built binary
59+
- unpublish - Unpublishes pre-built binary
60+
- info - Fetches info on published binaries
61+
62+
You can also chain commands:
63+
64+
node-pre-gyp clean build unpublish publish info
65+
66+
### Configuring your module to use node-pre-gyp
67+
68+
**1) Add new entries to your `package.json`**
69+
70+
We need to:
71+
72+
- Add node-pre-gyp as a bundled dependency
73+
- Add a custom `install` script
74+
- Add a `binary` object
75+
76+
This looks like:
3477

3578
```js
3679
"dependencies" : {
3780
"node-pre-gyp": "0.5.x"
3881
},
3982
"bundledDependencies":["node-pre-gyp"],
40-
```
41-
42-
43-
**2) Add a custom `install` script to `package.json`**
44-
45-
```js
4683
"scripts": {
4784
"install": "node-pre-gyp install --fallback-to-build",
4885
}
49-
```
50-
51-
**3) Add a `binary` property to `package.json`**
52-
53-
A simple example is:
54-
55-
```js
5686
"binary": {
57-
"module_name": "node_sqlite3",
87+
"module_name": "your_module",
5888
"module_path": "./lib/binding/",
59-
"host": "https://node-sqlite3.s3.amazonaws.com",
89+
"host": "https://your_module.s3-us-west-1.amazonaws.com",
6090
}
6191
```
6292

63-
Required properties:
93+
#### The `binary` object has three required properties
6494

6595
##### module_name
6696

67-
The name of your native node module. This must match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world) and should not include the `.node` extension.
97+
The name of your native node module.This must match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world) and should not include the `.node` extension.
6898

6999
##### module_path
70100

@@ -74,7 +104,7 @@ The location your native module is placed after a build. This should be an empty
74104

75105
A url to the remote location where you've published tarball binaries (must be `https` not `http`)
76106

77-
Optional properties:
107+
#### The `binary` object has two optional properties
78108

79109
##### remote_path
80110

@@ -292,33 +322,6 @@ Or you could automatically detect if the git branch is a tag:
292322
Remember this publishing is not the same as `npm publish`. We're just talking about the
293323
binary module here and not your entire npm package. To automate the publishing of your entire package to npm on travis see http://about.travis-ci.org/docs/user/deployment/npm/
294324

295-
### Commands
296-
297-
View all possible commands:
298-
299-
node-pre-gyp --help
300-
301-
302-
#### List published binaries
303-
304-
node-pre-gyp info
305-
306-
#### Unpublish binaries
307-
308-
node-pre-gyp unpublish
309-
310-
#### Clean install and build artifacts
311-
312-
node-pre-gyp clean
313-
314-
#### Clean and install
315-
316-
node-pre-gyp reinstall # runs "clean" and "install"
317-
318-
#### Chaining commands
319-
320-
node-pre-gyp clean build unpublish publish info
321-
322325
### Options
323326

324327
Options include:

0 commit comments

Comments
 (0)