@stoprocent/noble 1.9.2-16 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/hci-uart/hci-serial-parser.js +1 -1
- package/lib/hci-uart/hci.js +26 -2
- package/lib/resolve-bindings.js +1 -37
- package/misc/0001-hci-uart-on-usb-cdc.patch +161 -0
- package/misc/nrf52840-usb-cdc.hex +8907 -0
- package/package.json +4 -16
- package/.github/workflows/fediverse-action.yml +0 -16
- package/.github/workflows/prebuild.yml +0 -65
- package/binding.gyp +0 -19
- package/test/lib/resolve-bindings.test.js +0 -102
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"name": "@stoprocent/noble",
|
|
9
9
|
"description": "A Node.js BLE (Bluetooth Low Energy) central library.",
|
|
10
|
-
"version": "1.
|
|
10
|
+
"version": "1.10.1",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git+https://github.com/stoprocent/noble.git"
|
|
@@ -35,15 +35,11 @@
|
|
|
35
35
|
"win32"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"debug": "^4.3.1"
|
|
39
|
-
"napi-thread-safe-callback": "^0.0.6",
|
|
40
|
-
"node-addon-api": "^4.2.0",
|
|
41
|
-
"node-gyp-build": "^4.3.0"
|
|
38
|
+
"debug": "^4.3.1"
|
|
42
39
|
},
|
|
43
40
|
"optionalDependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"serialport": "^9.2.5"
|
|
41
|
+
"async": "^3.2.4",
|
|
42
|
+
"serialport": "^10.4.0"
|
|
47
43
|
},
|
|
48
44
|
"devDependencies": {
|
|
49
45
|
"async": "^3.2.0",
|
|
@@ -66,16 +62,8 @@
|
|
|
66
62
|
"ws": "^8.3.0"
|
|
67
63
|
},
|
|
68
64
|
"scripts": {
|
|
69
|
-
"install": "node-gyp-build",
|
|
70
65
|
"lint": "eslint \"**/*.js\"",
|
|
71
66
|
"lint-fix": "eslint \"**/*.js\" --fix",
|
|
72
|
-
"prebuild": "prebuildify --napi --strip",
|
|
73
|
-
"prebuild-darwin": "prebuildify --napi --strip --arch x64+arm64",
|
|
74
|
-
"prebuild-win32": "prebuildify --napi --strip",
|
|
75
|
-
"prebuild-linux": "prebuildify --napi --strip",
|
|
76
|
-
"prebuild-download": "prebuildify-ci download",
|
|
77
|
-
"pretest": "npm run rebuild",
|
|
78
|
-
"rebuild": "node-gyp rebuild",
|
|
79
67
|
"coverage": "nyc npm test && nyc report --reporter=text-lcov > .nyc_output/lcov.info",
|
|
80
68
|
"test": "cross-env NODE_ENV=test mocha --recursive \"test/*.test.js\" \"test/**/*.test.js\" --exit"
|
|
81
69
|
},
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# YAML
|
|
2
|
-
---
|
|
3
|
-
name: fediverse-action
|
|
4
|
-
on: [push]
|
|
5
|
-
jobs:
|
|
6
|
-
post:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v1
|
|
10
|
-
- id: log
|
|
11
|
-
run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)"
|
|
12
|
-
- if: "contains(steps.log.outputs.message, 'Release ')"
|
|
13
|
-
uses: rzr/fediverse-action@master
|
|
14
|
-
with:
|
|
15
|
-
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
|
|
16
|
-
message: "https://github.com/${{ github.repository }}/commit/${{ steps.log.outputs.message }} ~ #FediVerseAction"
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
name: prebuild
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
tags:
|
|
8
|
-
- '*'
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
workflow_dispatch:
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
prebuild:
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
include:
|
|
19
|
-
- name: darwin
|
|
20
|
-
os: macos-11
|
|
21
|
-
node: x64
|
|
22
|
-
- name: linux
|
|
23
|
-
os: ubuntu-latest
|
|
24
|
-
- name: win32
|
|
25
|
-
os: windows-2016
|
|
26
|
-
name: Build ${{ matrix.name }}
|
|
27
|
-
runs-on: ${{ matrix.os }}
|
|
28
|
-
steps:
|
|
29
|
-
- if: matrix.node
|
|
30
|
-
uses: actions/setup-node@v2
|
|
31
|
-
with:
|
|
32
|
-
node-version: 14.x
|
|
33
|
-
architecture: ${{ matrix.node }}
|
|
34
|
-
- uses: actions/checkout@v2
|
|
35
|
-
- name: Install dependencies (ubuntu-latest)
|
|
36
|
-
# Use g++-9 only on versions after 'ubuntu-18.04'
|
|
37
|
-
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
38
|
-
run: |
|
|
39
|
-
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
40
|
-
sudo apt -qq update
|
|
41
|
-
sudo apt install -y g++-9
|
|
42
|
-
export CC="g++-9"
|
|
43
|
-
- run: npm install --ignore-scripts
|
|
44
|
-
- run: npm run prebuild-${{ matrix.name }}
|
|
45
|
-
- run: tar -zcvf ${{ matrix.name }}.tar.gz -C prebuilds .
|
|
46
|
-
- uses: actions/upload-artifact@v2
|
|
47
|
-
with:
|
|
48
|
-
name: ${{ matrix.name }}
|
|
49
|
-
path: ${{ matrix.name }}.tar.gz
|
|
50
|
-
retention-days: 1
|
|
51
|
-
release:
|
|
52
|
-
needs: prebuild
|
|
53
|
-
name: Release
|
|
54
|
-
runs-on: ubuntu-latest
|
|
55
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
56
|
-
steps:
|
|
57
|
-
- uses: actions/checkout@v2
|
|
58
|
-
- uses: actions/download-artifact@v2
|
|
59
|
-
with:
|
|
60
|
-
path: artifacts
|
|
61
|
-
- uses: docker://antonyurchenko/git-release:v4
|
|
62
|
-
env:
|
|
63
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
64
|
-
with:
|
|
65
|
-
args: artifacts/*/*.tar.gz
|
package/binding.gyp
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
'targets': [
|
|
3
|
-
{
|
|
4
|
-
'target_name': 'noble',
|
|
5
|
-
'conditions': [
|
|
6
|
-
['OS=="mac"', {
|
|
7
|
-
'dependencies': [
|
|
8
|
-
'lib/mac/binding.gyp:binding',
|
|
9
|
-
],
|
|
10
|
-
}],
|
|
11
|
-
['OS=="win"', {
|
|
12
|
-
'dependencies': [
|
|
13
|
-
'lib/win/binding.gyp:binding',
|
|
14
|
-
],
|
|
15
|
-
}],
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
const should = require('should');
|
|
2
|
-
const proxyquire = require('proxyquire').noCallThru();
|
|
3
|
-
const { EventEmitter } = require('events');
|
|
4
|
-
|
|
5
|
-
let chosenPlatform;
|
|
6
|
-
let chosenRelease;
|
|
7
|
-
const platform = () => chosenPlatform;
|
|
8
|
-
const release = () => chosenRelease;
|
|
9
|
-
|
|
10
|
-
class NobleMac {}
|
|
11
|
-
|
|
12
|
-
class NobleWinrt {}
|
|
13
|
-
|
|
14
|
-
const NobleMacImport = proxyquire('../../lib/mac/bindings', {
|
|
15
|
-
'node-gyp-build': () => ({ NobleMac })
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const NobleWinrtImport = proxyquire('../../lib/win/bindings', {
|
|
19
|
-
'node-gyp-build': () => ({ NobleWinrt })
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const WebSocket = require('../../lib/websocket/bindings');
|
|
23
|
-
const NobleBindings = proxyquire('../../lib/distributed/bindings', {
|
|
24
|
-
ws: { Server: EventEmitter }
|
|
25
|
-
});
|
|
26
|
-
const HciNobleBindings = proxyquire('../../lib/hci-socket/bindings', {
|
|
27
|
-
'./hci': EventEmitter
|
|
28
|
-
});
|
|
29
|
-
const resolver = proxyquire('../../lib/resolve-bindings', {
|
|
30
|
-
'./distributed/bindings': NobleBindings,
|
|
31
|
-
'./hci-socket/bindings': HciNobleBindings,
|
|
32
|
-
'./mac/bindings': NobleMacImport,
|
|
33
|
-
'./win/bindings': NobleWinrtImport,
|
|
34
|
-
os: { platform, release }
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('resolve-bindings', () => {
|
|
38
|
-
const OLD_ENV = process.env;
|
|
39
|
-
|
|
40
|
-
beforeEach(() => {
|
|
41
|
-
// Clone initial environment
|
|
42
|
-
process.env = Object.assign({}, OLD_ENV);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
afterEach(() => {
|
|
46
|
-
// Restore initial environment
|
|
47
|
-
process.env = OLD_ENV;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('web socket', () => {
|
|
51
|
-
process.env.NOBLE_WEBSOCKET = true;
|
|
52
|
-
|
|
53
|
-
const bindings = resolver({});
|
|
54
|
-
should(bindings).instanceof(WebSocket);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('distributed', () => {
|
|
58
|
-
process.env.NOBLE_DISTRIBUTED = true;
|
|
59
|
-
|
|
60
|
-
const bindings = resolver({});
|
|
61
|
-
should(bindings).instanceof(NobleBindings);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('mac', () => {
|
|
65
|
-
chosenPlatform = 'darwin';
|
|
66
|
-
|
|
67
|
-
const bindings = resolver({});
|
|
68
|
-
should(bindings).instanceof(NobleMac);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('linux', () => {
|
|
72
|
-
chosenPlatform = 'linux';
|
|
73
|
-
|
|
74
|
-
const bindings = resolver({});
|
|
75
|
-
should(bindings).instanceof(HciNobleBindings);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('freebsd', () => {
|
|
79
|
-
chosenPlatform = 'freebsd';
|
|
80
|
-
|
|
81
|
-
const bindings = resolver({});
|
|
82
|
-
should(bindings).instanceof(HciNobleBindings);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('win32', () => {
|
|
86
|
-
chosenPlatform = 'win32';
|
|
87
|
-
chosenRelease = '10.0.22000';
|
|
88
|
-
|
|
89
|
-
const bindings = resolver({});
|
|
90
|
-
should(bindings).instanceof(NobleWinrt);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('unknwon', () => {
|
|
94
|
-
chosenPlatform = 'unknwon';
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
resolver({});
|
|
98
|
-
} catch (e) {
|
|
99
|
-
should(e).have.property('message', 'Unsupported platform');
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|