From aa0c2d8eca82c7fe8653f91dbe1e196058d5f616 Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Sun, 30 Jun 2024 02:43:55 -0400 Subject: [PATCH 1/6] example ts app --- example/example.ts | 26 ++++++++++++++++++++++++++ example/package.json | 19 +++++++++++++++++++ example/tsconfig.json | 31 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 example/example.ts create mode 100644 example/package.json create mode 100644 example/tsconfig.json diff --git a/example/example.ts b/example/example.ts new file mode 100644 index 0000000..f323718 --- /dev/null +++ b/example/example.ts @@ -0,0 +1,26 @@ +import { HttpConnection } from "./dist" + +const Connect = async () => { + console.log("Running..."); + const connection = new HttpConnection() + await connection.connect({ + address: "meshtastic.local", + fetchInterval: 2000, + tls: false, + }); + + connection.events.onMessagePacket.subscribe((packet) => { + onMessage(packet.from, packet.data) + }) + + connection.events.onPrivatePacket.subscribe((packet) => { + onMessage(packet.from, packet.data) + }) +} + +const onMessage = (sender, message) => { + console.log("Message from: " + sender); + console.log("Message was: " + String(message)); +} + +Connect(); \ No newline at end of file diff --git a/example/package.json b/example/package.json new file mode 100644 index 0000000..d94bacf --- /dev/null +++ b/example/package.json @@ -0,0 +1,19 @@ +{ + "name": "example", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "tsx example.ts" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "module", + "dependencies": { + }, + "devDependencies": { + "tsx": "^4.16.0" + }, + "engines": {"node": ">=19.0.0"} +} diff --git a/example/tsconfig.json b/example/tsconfig.json new file mode 100644 index 0000000..bf507ed --- /dev/null +++ b/example/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "moduleResolution": "NodeNext", + "target": "ESNext", + "inlineSourceMap": true, + "declaration": true, + "outDir": "./dist", + "strict": true, + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "removeComments": false + }, + "include": ["../src/**/*"], + "ts-node": { "esm": true }, + "typedocOptions": { + "out": "docs" + } +} From 8c9e2ef9fb10d588595b85d0334da7ad139aef61 Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Sun, 30 Jun 2024 02:45:16 -0400 Subject: [PATCH 2/6] remove esm --- example/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/example/tsconfig.json b/example/tsconfig.json index bf507ed..232b6bf 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -24,7 +24,6 @@ "removeComments": false }, "include": ["../src/**/*"], - "ts-node": { "esm": true }, "typedocOptions": { "out": "docs" } From 697666eae2f0c9025de0f6f89bb9f0dab9716e26 Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Sun, 30 Jun 2024 02:48:54 -0400 Subject: [PATCH 3/6] biome fixes --- example/example.ts | 18 +++++++++--------- example/package.json | 5 ++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/example/example.ts b/example/example.ts index f323718..dd2c08a 100644 --- a/example/example.ts +++ b/example/example.ts @@ -1,8 +1,8 @@ -import { HttpConnection } from "./dist" +import { HttpConnection } from "./dist"; const Connect = async () => { console.log("Running..."); - const connection = new HttpConnection() + const connection = new HttpConnection(); await connection.connect({ address: "meshtastic.local", fetchInterval: 2000, @@ -10,17 +10,17 @@ const Connect = async () => { }); connection.events.onMessagePacket.subscribe((packet) => { - onMessage(packet.from, packet.data) - }) + onMessage(packet.from, packet.data); + }); connection.events.onPrivatePacket.subscribe((packet) => { - onMessage(packet.from, packet.data) - }) -} + onMessage(packet.from, packet.data); + }); +}; const onMessage = (sender, message) => { console.log("Message from: " + sender); console.log("Message was: " + String(message)); -} +}; -Connect(); \ No newline at end of file +Connect(); diff --git a/example/package.json b/example/package.json index d94bacf..01be90a 100644 --- a/example/package.json +++ b/example/package.json @@ -10,10 +10,9 @@ "author": "", "license": "ISC", "type": "module", - "dependencies": { - }, + "dependencies": {}, "devDependencies": { "tsx": "^4.16.0" }, - "engines": {"node": ">=19.0.0"} + "engines": { "node": ">=19.0.0" } } From 3759ec6e92a99958620b202aecab3f7ee7d060dd Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Sun, 30 Jun 2024 02:53:16 -0400 Subject: [PATCH 4/6] version bump --- example/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/package.json b/example/package.json index 01be90a..035f9f4 100644 --- a/example/package.json +++ b/example/package.json @@ -1,6 +1,6 @@ { "name": "example", - "version": "1.0.0", + "version": "1.0.1", "description": "", "main": "index.js", "scripts": { @@ -8,7 +8,7 @@ }, "keywords": [], "author": "", - "license": "ISC", + "license": "GPL-3.0-only", "type": "module", "dependencies": {}, "devDependencies": { From 646942683774dfdf3d9442663718a01bcaa944fb Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Sun, 30 Jun 2024 02:55:10 -0400 Subject: [PATCH 5/6] bump the proper package.json (its 3am) --- example/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/package.json b/example/package.json index 035f9f4..fbdaa99 100644 --- a/example/package.json +++ b/example/package.json @@ -1,6 +1,6 @@ { "name": "example", - "version": "1.0.1", + "version": "1.0.0", "description": "", "main": "index.js", "scripts": { diff --git a/package.json b/package.json index 4937018..cb80a52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@meshtastic/js", - "version": "2.3.7-0", + "version": "2.3.8-0", "description": "Browser library for interfacing with meshtastic devices", "license": "GPL-3.0-only", "scripts": { From afe3c6b74d8ca3b4a53c212e2d20ab63bf9c546e Mon Sep 17 00:00:00 2001 From: Hunter Thornsberry Date: Sun, 30 Jun 2024 10:34:02 -0400 Subject: [PATCH 6/6] readme and package.json update to properly build --- example/README.md | 11 +++++++++++ example/package.json | 10 +++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 example/README.md diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..e68481c --- /dev/null +++ b/example/README.md @@ -0,0 +1,11 @@ +# Example App +Be sure to read the README in the root folder first. + +# How-to +`pnpm i` + +`pnpm start` + +# Requirements +1. Node.js 19.0.0+ +2. pnpm 9.0+ (different than root) \ No newline at end of file diff --git a/example/package.json b/example/package.json index fbdaa99..a34bddd 100644 --- a/example/package.json +++ b/example/package.json @@ -4,15 +4,19 @@ "description": "", "main": "index.js", "scripts": { - "start": "tsx example.ts" + "start": "tsc && tsx example.ts" }, "keywords": [], "author": "", "license": "GPL-3.0-only", "type": "module", - "dependencies": {}, + "dependencies": { + "typescript": "^5.5.2" + }, "devDependencies": { "tsx": "^4.16.0" }, - "engines": { "node": ">=19.0.0" } + "engines": { + "node": ">=19.0.0" + } }