Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ts dependencies #120

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/support/steps/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Given('these lobbies exist:', async function (this: World, lobbies: DataTable) {
const v: string[] = []

Object.keys(row).forEach(key => {
const value = row[key] as string
const value = row[key]
if (key === 'playerCount') {
if (!columns.includes('peers')) {
columns.push('peers')
Expand Down Expand Up @@ -258,7 +258,7 @@ Then('{string} should have received only these lobbies:', function (this: World,
if (player == null) {
throw new Error('no such player')
}
expectedLobbies.hashes().forEach((row: {code: string}) => {
expectedLobbies.hashes().forEach(row => {
const correctCodeLobby = player.lastReceivedLobbies.filter(lobby => lobby.code === row.code)
if (correctCodeLobby.length !== 1) {
throw new Error(`expected to find one lobby with code ${row.code} but found ${correctCodeLobby.length}`)
Expand Down
2 changes: 1 addition & 1 deletion features/support/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Player {
this.network.on(eventName as any, function () {
// console.log(name, `(${network.id})`, 'received event', eventName, `${arguments[0] as string}`, arguments[1], arguments[2])
events.push({
eventName: eventName,
eventName,
eventPayload: arguments
})
})
Expand Down
8 changes: 4 additions & 4 deletions features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class World extends CucumberWorld {
}
setWorldConstructor(World)

BeforeAll((cb: Function) => {
BeforeAll(async () => await new Promise(resolve => {
let c = 2;
['signaling', 'testproxy'].forEach(backend => {
const proc = spawn('go', ['build', '-o', `/tmp/netlib-cucumber-${backend}`, `cmd/${backend}/main.go`], {
Expand All @@ -74,13 +74,13 @@ BeforeAll((cb: Function) => {
process.exit(1)
}
if (--c === 0) {
cb()
resolve(undefined)
}
})
})
})
}))

AfterAll(function (this: World) {
AfterAll(function () {
unlinkSync('/tmp/netlib-cucumber-signaling')
unlinkSync('/tmp/netlib-cucumber-testproxy')

Expand Down
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const DefaultRTCConfiguration: PeerConfiguration = {
]
}

export const DefaultDataChannels: {[label: string]: RTCDataChannelInit} = {
export const DefaultDataChannels: { [label: string]: RTCDataChannelInit } = {
reliable: {
ordered: true
},
Expand Down
4 changes: 2 additions & 2 deletions lib/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class Network extends EventEmitter<NetworkListeners> {
public readonly peers: Map<string, Peer>
private readonly signaling: Signaling
private readonly credentials: Credentials
public dataChannels: {[label: string]: RTCDataChannelInit} = DefaultDataChannels
public dataChannels: { [label: string]: RTCDataChannelInit } = DefaultDataChannels

public log: (...data: any[]) => void = (...args: any[]) => {} // console.log

Expand Down Expand Up @@ -76,7 +76,7 @@ export default class Network extends EventEmitter<NetworkListeners> {
return ''
}

async join (lobby: string): Promise<LobbyListEntry|undefined> {
async join (lobby: string): Promise<LobbyListEntry | undefined> {
if (this._closing || this.signaling.receivedID === undefined) {
return undefined
}
Expand Down
2 changes: 1 addition & 1 deletion lib/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class Peer {
private politenessTimeout?: ReturnType<typeof setTimeout>
private reportLatencyEventTimeout?: ReturnType<typeof setTimeout>
private readonly checkStateInterval: ReturnType<typeof setInterval>
private readonly channels: {[name: string]: RTCDataChannel}
private readonly channels: { [name: string]: RTCDataChannel }

private readonly testSessionWrapper?: (desc: RTCSessionDescription, config: PeerConfiguration, selfID: string, otherID: string) => Promise<void>

Expand Down
2 changes: 1 addition & 1 deletion lib/signaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export default class Signaling extends EventEmitter<SignalingListeners> {
}
}

async event (category: string, action: string, data?: {[key: string]: string}): Promise<void> {
async event (category: string, action: string, data?: { [key: string]: string }): Promise<void> {
return await new Promise(resolve => {
setTimeout(() => {
this.send({
Expand Down
8 changes: 4 additions & 4 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export interface LobbySettings {
maxPlayers?: number
password?: string
public?: boolean
customData?: {[key: string]: any}
customData?: { [key: string]: any }
canEditBy?: 'creator' | 'leader' | 'anyone' | 'none'
}

export interface LobbyListEntry {
code: string
public: boolean
playerCount: number
customData?: {[key: string]: any}
customData?: { [key: string]: any }
leader?: string
term: number
createdAt: string
Expand Down Expand Up @@ -113,7 +113,7 @@ export interface LeaderPacket extends Base {
export interface LobbyUpdatePacket extends Base {
type: 'lobbyUpdate'
public?: boolean
customData?: {[key: string]: any}
customData?: { [key: string]: any }
canEditBy?: 'creator' | 'leader' | 'anyone' | 'none'
}

Expand Down Expand Up @@ -182,5 +182,5 @@ export interface EventPacket extends Base {
peer: string
lobby?: string

data?: {[key: string]: string}
data?: { [key: string]: string }
}
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,25 @@
"prepare": "yarn build",
"build": "parcel build",
"lint": "ts-standard --fix",
"cucumber": "./node_modules/@cucumber/cucumber/bin/cucumber-js --require 'features/support/**/*.ts' --require-module ts-node/register --publish-quiet --format @cucumber/pretty-formatter --order random --retry 2 --retry-tag-filter flakey",
"cucumber": "cucumber-js --require 'features/support/**/*.ts' --require-module ts-node/register --order random --retry 2 --retry-tag-filter flakey",
"watch": "parcel --no-hmr example/index.html"
},
"dependencies": {
"eventemitter3": "^4.0.7"
"eventemitter3": "^5.0.1"
},
"devDependencies": {
"@cucumber/cucumber": "7.0.0",
"@cucumber/pretty-formatter": "1.0.0-alpha.0",
"@parcel/packager-ts": "2.8.3",
"@parcel/transformer-typescript-types": "2.8.3",
"@roamhq/wrtc": "^0.7.1",
"@types/node-fetch": "2",
"@types/ws": "^7.4.7",
"node-fetch": "2",
"parcel": "^2.6.0",
"ts-node": "^10.1.0",
"ts-standard": "^11.0.0",
"typescript": "^4.3.4",
"ws": "^8.17.1"
"@cucumber/cucumber": "^10.8.0",
"@parcel/packager-ts": "^2.12.0",
"@parcel/transformer-typescript-types": "^2.12.0",
"@roamhq/wrtc": "^0.8.0",
"@types/node-fetch": "^2.6.11",
"@types/ws": "^8.5.11",
"node-fetch": "=2.7.0",
"parcel": "^2.12.0",
"ts-node": "^10.9.2",
"ts-standard": "^12.0.2",
"typescript": "^5.5.4",
"ws": "^8.18.0"
},
"engines": {
"node": ">=14"
Expand Down
Loading