diff --git a/README.md b/README.md index e8982004dd00d349b2278a92b9356c74244adef0..6884c4cdb68c0dfe8810129a4e4c6a4159c56304 100644 --- a/README.md +++ b/README.md @@ -10,25 +10,21 @@ Helper library for easy usp communication using mqtt over tcp or ws. # Usage ```javascript -const connect = require("usp-js").default; - -const options = { - host: "192.168.1.1", - port: 9001, - protocol: "mqtt", - username: "admin", - password: "admin", -}; +const connect = require("usp-js").default const run = async () => { // Connect to device - const device = await connect(options); + const device = await connect({ + host: "192.168.1.1", + username: "admin", + password: "admin" + }); // Get property - await get("Device.WiFi.").then(console.log); + await device.get("Device.WiFi.").then(console.log); // Disconnect - await disconnect(session); + await device.disconnect(); }; run(); diff --git a/package.json b/package.json index a84d595f134d928380cd65334074c4ae9379ffb4..32a30dcc7eb178da5f723c71d1ffa9b1ffe42152 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "usp-js", - "version": "0.0.1", + "version": "0.0.2", "description": "Helper library for easy usp communication using mqtt over tcp or ws.", "main": "build/index.js", "scripts": { "dev": "tsc -w --outDir build", "build": "tsc --outDir build", "test": "npm run build && mocha tests/unit", - "test:device": "npm run build && mocha tests/integration" + "test:device": "npm run build && mocha tests/integration", + "prepublish": "npm run build" }, "keywords": [], "author": "Marin Karamihalev <marin.karamihalev@iopsys.eu> (http://iopsys.eu)", @@ -22,5 +23,5 @@ "typescript": "^4.0.5" }, "type": "commonjs", - "types": "src/types.d.ts" + "types": "build/index.d.ts" }