UBERF-10599: Fix ws not found in gmail (#8943)

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko 2025-05-15 21:24:19 +07:00 committed by GitHub
parent ea99f3d074
commit 259b3ff921
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -19,7 +19,12 @@ import { type ClientSocket, type ClientSocketFactory } from '@hcengineering/clie
export const NodeWebSocketFactory: ClientSocketFactory = (url: string): ClientSocket => {
// We need to override default factory with 'ws' one.
// eslint-disable-next-line
const WebSocket = require('ws')
let WebSocket
try {
WebSocket = require('ws')
} catch (error) {
throw new Error('The "ws" package is required for NodeWebSocketFactory. ')
}
type WebSocketData = Parameters<typeof ws.on>[1]
const ws = new WebSocket(url)

View File

@ -14,10 +14,10 @@
"build": "compile",
"build:watch": "compile",
"test": "jest --passWithNoTests --silent",
"_phase:bundle": "rushx bundle --external=ws",
"_phase:bundle": "rushx bundle",
"_phase:docker-build": "rushx docker:build",
"_phase:docker-staging": "rushx docker:staging",
"bundle": "node ../../../common/scripts/esbuild.js --external=ws",
"bundle": "node ../../../common/scripts/esbuild.js",
"docker:build": "../../../common/scripts/docker_build.sh hardcoreeng/gmail",
"docker:tbuild": "docker build -t hardcoreeng/gmail . --platform=linux/amd64 && ../../../common/scripts/docker_tag_push.sh hardcoreeng/gmail",
"docker:staging": "../../../common/scripts/docker_tag.sh hardcoreeng/gmail staging",