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