Switch to yarn

This commit is contained in:
Jonathan Staab
2023-07-07 16:34:44 -07:00
parent b74f2e8e3d
commit 46470aabe4
6 changed files with 2672 additions and 8564 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run check
npm run lint
-8531
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -14,10 +14,10 @@
},
"scripts": {
"build": "node build.js",
"pub": "npm i && npm run check && node build.js && npm publish",
"check:ts": "tsc --noEmit --esModuleInterop --strict src/**/*",
"check:es": "eslint src/*",
"check": "run-p check:*"
"pub": "npm i && npm run lint && node build.js && npm publish",
"lint:ts": "tsc --noEmit --esModuleInterop --strict src/**/*",
"lint:es": "eslint src/*",
"lint": "run-p lint:*"
},
"keywords": [
"nostr"
+3 -3
View File
@@ -4,11 +4,11 @@ export class Relay {
constructor(socket) {
this.socket = socket
this.bus = new EventBus()
this.listeners = sockets.map(socket => {
return socket.bus.addListener('message', (url, [verb, ...payload]) => {
this.listeners = [
socket.bus.addListener('message', (url, [verb, ...payload]) => {
this.bus.emit(verb, url, ...payload)
})
})
]
}
get sockets() {
return [this.socket]
+21 -25
View File
@@ -27,34 +27,30 @@ export class Socket {
this.queue = []
this.bus = new EventBus()
this.status = Socket.STATUS.NEW
}
onOpen() {
this.error = undefined
this.status = Socket.STATUS.READY
this.ready.resolve()
this.bus.emit('open')
}
onMessage(event) {
this.queue.push(event.data as string)
this._onOpen = () => {
this.error = undefined
this.status = Socket.STATUS.READY
this.ready.resolve()
this.bus.emit('open')
}
this._onMessage = event => {
this.queue.push(event.data as string)
if (!this.timeout) {
this.handleMessagesAsync()
}
}
this._onError = (error: Error) => {
this.error = error
this.bus.emit('error', error)
}
this._onClose = () => {
this.disconnect()
this.ready.reject()
this.status = Socket.STATUS.CLOSED
this.bus.emit('close')
if (!this.timeout) {
this.handleMessagesAsync()
}
}
onError(error: Error) {
this.error = error
this.bus.emit('error', error)
}
onClose() {
this.disconnect()
this.ready.reject()
this.status = Socket.STATUS.CLOSED
this.bus.emit('close')
}
async connect() {
if ([Socket.STATUS.NEW, Socket.STATUS.CLOSED].includes(this.status)) {
if (this.ws) {
+2643
View File
File diff suppressed because it is too large Load Diff