Skip to content

Commit

Permalink
Add node-pre-gyp support for prebuilt binaries (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmyth authored and defunctzombie committed Sep 3, 2016
1 parent 6191bb9 commit a5ecd97
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 4 deletions.
44 changes: 44 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
environment:
matrix:
- nodejs_version: "0.10"
platform: x64
- nodejs_version: "0.10"
platform: x86
- nodejs_version: "0.12"
platform: x64
- nodejs_version: "0.12"
platform: x86
- nodejs_version: "4"
platform: x64
- nodejs_version: "4"
platform: x86
- nodejs_version: "5"
platform: x64
- nodejs_version: "5"
platform: x86
- nodejs_version: "6"
platform: x64
- nodejs_version: "6"
platform: x86

install:
- where npm
- where node
- ps: Install-Product node $env:nodejs_version $env:platform
- for /f "delims=" %%a in ('where npm') do cd %%a\.. && npm install npm@latest
- for /f "delims=" %%a in ('where npm') do cd %%a\.. && npm install node-pre-gyp@latest
- 'if "%nodejs_version%_%platform%" == "4_x86" (npm config set -g cafile=package.json && npm config set -g strict-ssl=false)'

build: off

artifacts:
- path: 'build/stage/**/bcrypt*.tar.gz'
- path: package.json

test_script:
- node --version
- npm --version
- npm test

after_test:
- node-pre-gyp package
6 changes: 5 additions & 1 deletion bcrypt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

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

var crypto = require('crypto');

/// generate a salt (sync)
Expand Down
11 changes: 11 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
],
}],
],
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
]
}
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
"url": "https://github.com/ncb000gt/node.bcrypt.js/issues"
},
"scripts": {
"test": "node-gyp configure build && nodeunit test"
"test": "npm install --build-from-source && nodeunit test",
"install": "node-pre-gyp install --fallback-to-build"
},
"dependencies": {
"bindings": "1.2.1",
"nan": "2.3.5"
"nan": "2.3.5",
"node-pre-gyp": "0.6.30"
},
"devDependencies": {
"nodeunit": "~0.9.1"
Expand All @@ -49,5 +51,11 @@
"Nate Rajlich <nathan@tootallnate.net> (https://github.com/tootallnate)",
"Sean McArthur <sean.monstar@gmail.com> (https://github.com/seanmonstar)",
"Fanie Oosthuysen <fanie.oosthuysen@gmail.com> (https://github.com/weareu)"
]
],
"binary": {
"module_name": "bcrypt_lib",
"module_path": "./lib/binding/",
"host": "https://github.com",
"remote_path": "/ncb000gt/node.bcrypt.js/releases/download/v{version}/"
}
}

0 comments on commit a5ecd97

Please sign in to comment.