+10
| language: node_js | ||
| node_js: | ||
| - "node" | ||
| after_success: | ||
| - "./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls" | ||
| notifications: | ||
| email: false |
+13
-9
@@ -6,21 +6,25 @@ #! /usr/bin/env node | ||
| args | ||
| .option('broker', 'MQTT Broker address', 'mqtt://localhost:1883') | ||
| .option('topic', 'MQTT topic with auto-subscription'); | ||
| const params = args.parse(process.argv); | ||
| const file = args.sub[0]; | ||
| const kifli = require(join('..', main)); | ||
| const start = async (broker, topic, config, listener) => { | ||
| const client = await kifli(broker, config); | ||
| const topic$ = await client.subscribe(topic); | ||
| topic$.onValue(listener(client)); | ||
| topic$ | ||
| .skipDuplicates((a, b) => JSON.stringify(a) === JSON.stringify(b)) | ||
| .onValue(listener(client)); | ||
| }; | ||
| args | ||
| .option('broker', 'MQTT Broker address', 'http://localhost:1883') | ||
| .option('topic', 'MQTT topic to auto-subscription'); | ||
| const clientId = [`${name}`, `${parse(file).name}`, `${process.pid}`].join('/'); | ||
| const params = args.parse(process.argv); | ||
| const file = args.sub[0]; | ||
| const kifli = require(join('..', main)); | ||
| start( | ||
| params['broker'], | ||
| params['topic'], | ||
| { clientId: [`${name}`, `${parse(file).name}`, `${process.pid}`].join('/') }, | ||
| { clientId }, | ||
| require(resolve(process.cwd(), file)) | ||
| ); |
@@ -44,3 +44,3 @@ const { test } = require('ava'); | ||
| const client = await sut('mqtt://fake.url', { clientId: 'test' }); | ||
| t.notThrows(client.publish('/test', 'foobar')); | ||
| t.notThrows(async () => await client.publish('/test', 'foobar')); | ||
| }); | ||
@@ -50,3 +50,3 @@ | ||
| const client = await sut('mqtt://fake.url', { clientId: 'test' }); | ||
| t.notThrows(client.end()); | ||
| t.notThrows(async () => await client.end()); | ||
| }); |
+11
-11
| { | ||
| "name": "kifli", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "nanoservice for mqtt protocol (nano+mqtt=kifli)", | ||
@@ -11,5 +11,4 @@ "main": "lib/index.js", | ||
| "scripts": { | ||
| "test": "ava -v -T 3000", | ||
| "cov": "nyc ava", | ||
| "report": "nyc --reporter=lcov ava" | ||
| "test": "nyc ava -v", | ||
| "report": "nyc report --reporter=lcov" | ||
| }, | ||
@@ -23,11 +22,12 @@ "keywords": [ | ||
| "dependencies": { | ||
| "args": "^2.3.0", | ||
| "debug": "^2.6.1", | ||
| "kefir": "^3.7.1", | ||
| "mqtt": "^2.4.0" | ||
| "args": "^3.0.8", | ||
| "debug": "^3.1.0", | ||
| "kefir": "^3.8.1", | ||
| "mqtt": "^2.15.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "^0.18.2", | ||
| "mock-require": "^2.0.1", | ||
| "nyc": "^10.1.2" | ||
| "ava": "^0.24.0", | ||
| "coveralls": "^3.0.0", | ||
| "mock-require": "^2.0.2", | ||
| "nyc": "^11.4.1" | ||
| }, | ||
@@ -34,0 +34,0 @@ "directories": { |
+8
-9
| # kifli | ||
| [](https://travis-ci.org/balazs4/kifli) | ||
| [](https://coveralls.io/github/balazs4/kifli?branch=master) | ||
| [](https://badge.fury.io/js/kifli) | ||
| [](https://david-dm.org/balazs4/kifli) | ||
| [](https://david-dm.org/balazs4/kifli?type=dev) | ||
| > nano library to handle messages sent throught MQTT protocol. It wraps the [mqtt.js](https://github.com/mqttjs/MQTT.js) module | ||
@@ -15,3 +21,3 @@ | ||
| + ``yarn add kifli`` | ||
| + ``npm install --save kifli`` | ||
| + add the following script to your ``package.json`` | ||
@@ -22,3 +28,3 @@ | ||
| "scripts": { | ||
| "start": "kifli handler.js --broker http://localhost:1883 --topic '/sum' " | ||
| "start": "kifli handler.js --broker mqtt://localhost:1883 --topic '/sum' " | ||
| } | ||
@@ -43,8 +49,1 @@ } | ||
| ```` | ||
| ## TODO | ||
| + [ ] mqtt config object | ||
| + [ ] API description | ||
| + [ ] more example |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
134311
12.7%170
1.8%4
33.33%47
-2.08%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated