mirror of
https://github.com/meshtastic/web.git
synced 2026-04-21 06:19:53 -04:00
Replace workspace formatter/linting tool (#799)
* replaced workspace formatter/linting tool * format / linting fixes
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.16.4",
|
||||
"biome": "^0.3.3",
|
||||
"@biomejs/biome": "2.0.6",
|
||||
"tsdown": "^0.13.4",
|
||||
"typescript": "^5.8.3",
|
||||
"vitest": "^3.2.4"
|
||||
|
||||
@@ -13,7 +13,8 @@ await build({
|
||||
// package.json properties
|
||||
name: "@meshtastic/transport-deno",
|
||||
version: Deno.args[0],
|
||||
description: "A Deno transport layer for your project, enabling seamless integration with npm.",
|
||||
description:
|
||||
"A Deno transport layer for your project, enabling seamless integration with npm.",
|
||||
license: "GPL-3.0-only",
|
||||
repository: {
|
||||
type: "git",
|
||||
|
||||
@@ -14,7 +14,10 @@ export class TransportNodeSerial implements Types.Transport {
|
||||
* @param baudRate - The port number for the TCP connection (defaults to 4403).
|
||||
* @returns A promise that resolves with a connected TransportNode instance.
|
||||
*/
|
||||
public static create(path: string, baudRate = 115200): Promise<TransportNodeSerial> {
|
||||
public static create(
|
||||
path: string,
|
||||
baudRate = 115200,
|
||||
): Promise<TransportNodeSerial> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const port = new SerialPort({
|
||||
path,
|
||||
@@ -45,9 +48,7 @@ export class TransportNodeSerial implements Types.Transport {
|
||||
console.error("Serial port connection error:", err);
|
||||
});
|
||||
|
||||
const fromDeviceSource = Readable.toWeb(
|
||||
port,
|
||||
) as ReadableStream<Uint8Array>;
|
||||
const fromDeviceSource = Readable.toWeb(port) as ReadableStream<Uint8Array>;
|
||||
this._fromDevice = fromDeviceSource.pipeThrough(Utils.fromDeviceStream());
|
||||
|
||||
// Stream for data going FROM the application TO the Meshtastic device.
|
||||
|
||||
@@ -95,6 +95,7 @@ export class TransportWebBluetooth implements Types.Transport {
|
||||
this._isFirstWrite = false;
|
||||
|
||||
setTimeout(() => {
|
||||
// biome-ignore lint/style/noNonNullAssertion: we know this will be set
|
||||
this.readFromRadio(this._fromDeviceController!);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export class TransportWebSerial implements Types.Transport {
|
||||
// Set up the pipe with abort signal for clean cancellation
|
||||
this.pipePromise = Utils.toDeviceStream.readable.pipeTo(
|
||||
connection.writable,
|
||||
{ signal: this.abortController.signal }
|
||||
{ signal: this.abortController.signal },
|
||||
);
|
||||
|
||||
this._toDevice = Utils.toDeviceStream.writable;
|
||||
@@ -58,31 +58,30 @@ export class TransportWebSerial implements Types.Transport {
|
||||
async disconnect() {
|
||||
try {
|
||||
this.abortController.abort();
|
||||
|
||||
|
||||
if (this.pipePromise) {
|
||||
try {
|
||||
await this.pipePromise;
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name !== 'AbortError') {
|
||||
if (error instanceof Error && error.name !== "AbortError") {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel any remaining streams
|
||||
if (this._fromDevice && this._fromDevice.locked) {
|
||||
if (this._fromDevice?.locked) {
|
||||
try {
|
||||
await this._fromDevice.cancel();
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// Stream cancellation might fail if already cancelled
|
||||
}
|
||||
}
|
||||
|
||||
await this.connection.close();
|
||||
|
||||
} catch (error) {
|
||||
// If we can't close cleanly, let the browser handle cleanup
|
||||
console.warn('Could not cleanly disconnect serial port:', error);
|
||||
console.warn("Could not cleanly disconnect serial port:", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +92,11 @@ export class TransportWebSerial implements Types.Transport {
|
||||
async reconnect() {
|
||||
// Create a new AbortController for the new connection
|
||||
this.abortController = new AbortController();
|
||||
|
||||
|
||||
// Re-establish the pipe connection
|
||||
this.pipePromise = Utils.toDeviceStream.readable.pipeTo(
|
||||
this.connection.writable,
|
||||
{ signal: this.abortController.signal }
|
||||
{ signal: this.abortController.signal },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
"zustand": "5.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.0.6",
|
||||
"@tanstack/router-plugin": "^1.127.9",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
|
||||
@@ -193,7 +193,7 @@ export const CommandPalette = () => {
|
||||
label: t("contextual.command.dfuMode"),
|
||||
icon: HardDriveUpload,
|
||||
action() {
|
||||
connection?.enterDfuMode()
|
||||
connection?.enterDfuMode();
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
749
pnpm-lock.yaml
generated
749
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user