Comparing version 0.5.7 to 0.6.0
var EventEmitter = require("events").EventEmitter, | ||
util = require("util"); | ||
//Load C++ binding | ||
var binding = require('bindings')('HID.node'); | ||
// lazy load the C++ binding | ||
var binding = null; | ||
function loadBinding() { | ||
if( !binding ) { | ||
//Load C++ binding | ||
binding = require('bindings')('HID.node'); | ||
} | ||
} | ||
@@ -12,2 +18,4 @@ //This class is a wrapper for `binding.HID` class | ||
loadBinding(); | ||
/* We also want to inherit from `binding.HID`, but unfortunately, | ||
@@ -102,4 +110,10 @@ it's not so easy for native Objects. For example, the | ||
function showdevices() { | ||
loadBinding(); | ||
return binding.devices.apply(HID,arguments); | ||
} | ||
//Expose API | ||
exports.HID = HID; | ||
exports.devices = binding.devices; | ||
exports.devices = showdevices; | ||
// exports.devices = binding.devices; |
{ | ||
"name": "node-hid", | ||
"description": "USB HID device access library", | ||
"version": "0.5.7", | ||
"version": "0.6.0", | ||
"author": "Hans Hübner <hans.huebner@gmail.com> (https://github.com/hanshuebner)", | ||
@@ -19,3 +19,3 @@ "contributors": [ | ||
"prebuild": "prebuild --all --verbose", | ||
"prebuild-upload": "prebuild --all --strip --verbose", | ||
"prebuild-upload": "prebuild --all --strip --verbose --upload", | ||
"rebuild": "prebuild --compile", | ||
@@ -22,0 +22,0 @@ "cleanbuild": "rimraf hidapi build node_modules" |
How to publish node-hid | ||
======================== | ||
### newer way (in short) ### | ||
On MacOSX, Windows, Linux, do: | ||
``` | ||
git clone https://github.com/node-hid/node-hid.git | ||
cd node-hid | ||
npm run prepublish # get the hidapi submodule | ||
npm install --build-from-source # rebuilds the C code | ||
node ./src/show-devices.js # simple tests | ||
npm run prebuild # build all the versions | ||
npm run prebuild-upload <gh-token> # upload all the versions using github token | ||
``` | ||
And then on master dev box: | ||
``` | ||
npm publish # update npmjs | ||
``` | ||
remember for Windows | ||
``` | ||
$env:PYTHON = "$env:USERPROFILE\.windows-build-tools\python27\python.exe" | ||
``` | ||
#### old way ### | ||
1. Merge all changes and new features into master | ||
2. Fill out `changelog.md` | ||
3. Bump up npm version in `package.json` | ||
4. Update the `README.md` to reference this current version | ||
5. Commit then generate new tags based on package.json version number with `git tag 0.5.4 -a` and include the change log in the tag's annotation. | ||
6. Push tags to Github with `git push --tags` | ||
7. Switch to node v4 and npm 2 | ||
8. `rm -rf node_modules build && npm install` | ||
9. Publish to npm after builds finish. Builds can take half an hour and occasionally fail for seemingly no reason. Restart any failures in the travis or appeveyor ui. While you wait, remove the content of the Github release message so the tag's text shows. When the entire matrix succeeds and all binaries exist run `npm publish`. | ||
2. Bump up npm version in `package.json` | ||
3. Update the `README.md` to reference this current version (if needed) | ||
4. Commit then generate new tags based on package.json version number | ||
with e.g. `git tag v0.5.4 -a` and include the change log in the tag's annotation. | ||
5. Push tags to Github with `git push --tags` | ||
6. Watch Travis and Appveyor CI builds | ||
7. Publish to npm after builds finish. Builds can take half an hour and occasionally fail for seemingly no reason. Restart any failures in the travis or appeveyor ui. While you wait, remove the content of the Github release message so the tag's text shows. When the entire matrix succeeds and all binaries exist run `npm publish`. | ||
@@ -15,0 +37,0 @@ |
@@ -45,16 +45,17 @@ # node-hid - Access USB HID devices from Node.js # | ||
`node-hid` supports Node.js v4 and upwards. For versions 0.10 and 0.12, | ||
you will need to build from source. The platforms, architectures and node versions `node-hid` supports are the following; | ||
you will need to build from source. The platforms, architectures and node versions `node-hid` supports are the following. | ||
Those with checks we provide pre-built binaries, for the others you will need to compile. | ||
| Platform / Arch | Node v4.x | Node v6.x | Node v7.x | | ||
| --- | --- | --- | --- | | ||
| Windows / x86 | ☑ | ☑ | ☑ | | ||
| Windows / x64 | ☑ | ☑ | ☑ | | ||
| Mac OSX / x64 | ☑ | ☑ | ☑ | | ||
| Linux / x64 | ☑ | ☑ | ☑ | | ||
| Linux / ia32 | ☐ | ☐ | ☐ | | ||
| Linux / ARM v6¹ | ☐ | ☐ | ☐ | | ||
| Linux / ARM v7¹ | ☐ | ☐ | ☐ | | ||
| Linux / ARM v8¹ | ☐ | ☐ | ☐ | | ||
| Linux / MIPSel¹ | ☐ | ☐ | ☐ | | ||
| Linux / PPC64¹ | ☐ | ☐ | ☐ | | ||
| Platform / Arch | Node v4.x | Node v6.x | Node v7.x | Node v8.x | Electron v1.0.2 | Electron v1.2.8 | Electron v1.3.13 | Electron v1.4.15 | Electron v1.5.0 | Electron v1.6.0 | Electron v1.7.0 | | ||
| --- | --- | --- | --- | --- | --- | --- |--- | --- | --- | --- | --- | | ||
| Windows / x86 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | | ||
| Windows / x64 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | | ||
| Mac OSX / x64 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | | ||
| Linux / x64 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | | ||
| Linux / ia32¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | | ||
| Linux / ARM v6¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | | ||
| Linux / ARM v7¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | | ||
| Linux / ARM v8¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | | ||
| Linux / MIPSel¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | | ||
| Linux / PPC64¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | | ||
@@ -253,2 +254,3 @@ ¹ ia32, ARM, MIPSel and PPC64 platforms are known to work but are not currently part of our test or build matrix. ARM v4 and v5 was dropped from Node.js after Node v0.10. | ||
- Mouse and keyboards on Windows -- does not work, the OS will not allow it | ||
- Xbox 360 Controller on Windows 10 -- does not work | ||
@@ -332,2 +334,3 @@ | ||
cd node-hid # must change into node-hid directory | ||
npm run prepublish # get the needed hidapi submodule | ||
npm install --build-from-source # rebuilds the module with C code | ||
@@ -337,3 +340,3 @@ node ./src/show-devices.js | ||
You will likely see some warnings from the C compiler as it compiles | ||
You will see some warnings from the C compiler as it compiles | ||
[hidapi](https://github.com/signal11/hidapi) (the underlying C library `node-hid` uses). | ||
@@ -344,3 +347,3 @@ This is expected. | ||
## Using `node-hid` in Electron projects | ||
In your electron project, add `electron-rebuild` and `electron-prebuilt` to your `devDependencies`. | ||
In your electron project, add `electron-rebuild` to your `devDependencies`. | ||
Then in your package.json `scripts` add: | ||
@@ -351,2 +354,5 @@ | ||
``` | ||
This will cause `npm` to rebuild `node-hid` for the version of Node that is in Electron. | ||
If you get an error similar to `The module "HID.node" was compiled against a differnt version of Node.js` | ||
then `electron-rebuild` hasn't been run and Electron is trying to use `node-hid` not built for it. | ||
@@ -356,3 +362,3 @@ If you want a specific version of electron, do something like: | ||
``` | ||
electron-rebuild -v 0.36.5 --force -m . -w node-hid | ||
"postinstall": "electron-rebuild -v 0.36.5 --force -m . -w node-hid" | ||
``` | ||
@@ -359,0 +365,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1449831
123
606
366