Skip to content

Commit

Permalink
fix test for node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
hzrd149 committed Jan 9, 2025
1 parent 0495fb9 commit aec45c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x]
fail-fast: false

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Setup Node.js 20
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install Dependencies
Expand Down
6 changes: 5 additions & 1 deletion packages/signer/src/signers/amber-clipboard-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { Nip07Interface } from "../nip-07.js";
*/
export class AmberClipboardSigner implements Nip07Interface {
/** If the signer is supported on this platform */
static SUPPORTED = navigator.userAgent.includes("Android") && navigator.clipboard && navigator.clipboard.readText;
static SUPPORTED =
`navigator` in globalThis &&
navigator.userAgent.includes("Android") &&
navigator.clipboard &&
navigator.clipboard.readText;

private pendingRequest: Deferred<string> | null = null;
public pubkey?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/signer/src/signers/serial-port-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class SerialPortSigner implements Nip07Interface {
}

async connectToDevice({ onConnect, onDisconnect, onError, onDone }: DeviceOpts): Promise<void> {
let port: SerialPort = await navigator.serial.requestPort();
let port: SerialPort = await window.navigator.serial.requestPort();
let reader;

const startSerialPortReading = async () => {
Expand Down Expand Up @@ -255,7 +255,7 @@ export class SerialPortSigner implements Nip07Interface {
}

// static const
static SUPPORTED = !!navigator.serial;
static SUPPORTED = "navigator" in globalThis && !!navigator.serial;

static METHOD_PING = "/ping";
static METHOD_LOG = "/log";
Expand Down

0 comments on commit aec45c6

Please sign in to comment.