Skip to content

Commit a024343

Browse files
committed
[minor] Use prebuildify (#105)
1 parent 70e0161 commit a024343

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
prebuilds/
21
build/
32
appveyor.yml
43
test.js

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,16 @@ node_js:
77
os:
88
- linux
99
- osx
10+
before_deploy:
11+
- ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$TRAVIS_OS_NAME-$(uname -m).tar"
12+
- npm run prebuild
13+
- tar --create --verbose --file="$ARCHIVE_NAME" --directory "$TRAVIS_BUILD_DIR/prebuilds" .
14+
deploy:
15+
provider: releases
16+
api_key:
17+
secure: OzQWRAFAR+oJ5uSFn2WwCun5RJDD5HQnPhXdJNj5ErpBy0CmiweF7YwnDhOywncw9Rz+iQEfg4MUCsnSkD0u5LRKmwvED/Y/ddol1VQTBmWREeQqCuGLr/DoD2nEnYoLIZWlIbqSEO3TtDaCuh818XqZhcfHms6jEMyF5WuKD/c=
18+
file: "$ARCHIVE_NAME"
19+
skip_cleanup: true
20+
on:
21+
tags: true
22+
node: "10"

appveyor.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
build: off
2+
configuration: Release
13
environment:
24
matrix:
35
- nodejs_version: "10"
@@ -15,4 +17,17 @@ test_script:
1517
- node --version
1618
- npm --version
1719
- npm test
18-
build: off
20+
after_test:
21+
- ps: If ($env:nodejs_version -eq "10") { npm run prebuild }
22+
- ps: $env:ARTIFACT_NAME_PREFIX = if (Test-Path env:APPVEYOR_REPO_TAG_NAME) { $env:APPVEYOR_REPO_TAG_NAME } else { 'latest' }
23+
artifacts:
24+
- path: prebuilds
25+
name: $(ARTIFACT_NAME_PREFIX)-win-$(PLATFORM)
26+
deploy:
27+
- provider: GitHub
28+
artifact: /.*\.zip/
29+
auth_token:
30+
secure: CkWRNlzH+wmCa3+TRydWfvmSH7tevR81aAypEhXTR9ka5q0Ja8lAIPDwtPb+Ux9l
31+
on:
32+
appveyor_repo_tag: true
33+
nodejs_version: "10"

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
try {
4-
module.exports = require('bindings')('bufferutil');
4+
module.exports = require('node-gyp-build')(__dirname);
55
} catch (e) {
66
module.exports = require('./fallback');
77
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"description": "WebSocket buffer utils",
55
"main": "index.js",
66
"scripts": {
7+
"install": "node-gyp-build",
8+
"prebuild": "prebuildify --napi",
79
"test": "mocha"
810
},
911
"repository": {
@@ -20,9 +22,10 @@
2022
},
2123
"homepage": "https://github.com/websockets/bufferutil",
2224
"dependencies": {
23-
"bindings": "~1.3.0"
25+
"node-gyp-build": "~3.4.0"
2426
},
2527
"devDependencies": {
26-
"mocha": "~5.2.0"
28+
"mocha": "~5.2.0",
29+
"prebuildify": "~2.7.0"
2730
}
2831
}

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ function use(bufferUtil) {
4343
};
4444
}
4545

46-
describe('bindings', use(require('bindings')('bufferutil')));
46+
describe('bindings', use(require('node-gyp-build')(__dirname)));
4747
describe('fallback', use(require('./fallback')));

0 commit comments

Comments
 (0)