From 53c76036df05a5248411170dff8498d11855ee31 Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Tue, 8 Apr 2025 19:48:43 +0200 Subject: [PATCH 1/3] fix: handle missing optional dependency in declarations --- fix-optional-dep-types.sh | 16 ++++++++++++++++ package.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 fix-optional-dep-types.sh diff --git a/fix-optional-dep-types.sh b/fix-optional-dep-types.sh new file mode 100755 index 0000000..9f75f54 --- /dev/null +++ b/fix-optional-dep-types.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +# Iterate through all *.d.ts files in the dist directory +find dist -type f -name "*.d.ts" | while read -r file; do + # Log file name and line number for matches + grep -n "^import .* from '@stream-io/openai-realtime-api';" "$file" | while IFS=: read -r linenum _; do + echo "Adding ts-ignore to declaration: $file:$linenum" + done || true + + # Use sed to prepend the comment to matching import statements + sed -i '' '/^import .* from '\''@stream-io\/openai-realtime-api'\'';/i\ +// @ts-ignore Optional dependency +' "$file" || true +done + diff --git a/package.json b/package.json index e9f5255..9040fd1 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "test": "vitest", "test:bun": "bun run vitest", "start": "rollup -w -c", - "build": "rm -rf dist && rollup -c", + "build": "rm -rf dist && rollup -c && ./fix-optional-dep-types.sh", "generate:open-api": "./generate-openapi.sh", "lint": "eslint **/*.ts", "lint:fix": "eslint --fix **/*.ts", From bff76a2f68265f5988fb1b25df3c426a9103c954 Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Tue, 8 Apr 2025 20:56:34 +0200 Subject: [PATCH 2/3] remove build step, use /** doc-style comments */ --- fix-optional-dep-types.sh | 16 ---------------- src/StreamVideoClient.ts | 2 ++ 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100755 fix-optional-dep-types.sh diff --git a/fix-optional-dep-types.sh b/fix-optional-dep-types.sh deleted file mode 100755 index 9f75f54..0000000 --- a/fix-optional-dep-types.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Iterate through all *.d.ts files in the dist directory -find dist -type f -name "*.d.ts" | while read -r file; do - # Log file name and line number for matches - grep -n "^import .* from '@stream-io/openai-realtime-api';" "$file" | while IFS=: read -r linenum _; do - echo "Adding ts-ignore to declaration: $file:$linenum" - done || true - - # Use sed to prepend the comment to matching import statements - sed -i '' '/^import .* from '\''@stream-io\/openai-realtime-api'\'';/i\ -// @ts-ignore Optional dependency -' "$file" || true -done - diff --git a/src/StreamVideoClient.ts b/src/StreamVideoClient.ts index 1a42f40..900bb72 100644 --- a/src/StreamVideoClient.ts +++ b/src/StreamVideoClient.ts @@ -2,6 +2,8 @@ import { VideoApi } from './gen/video/VideoApi'; import { StreamCall } from './StreamCall'; import type { StreamClient } from './StreamClient'; import type { ApiConfig } from './types'; +// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error +/** @ts-ignore Optional dependency */ import type { createRealtimeClient, RealtimeAPIModel, From 780bc00f2513ad42c2ea8cdb996bcfcece9df633 Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Tue, 8 Apr 2025 21:15:57 +0200 Subject: [PATCH 3/3] fix build command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9040fd1..e9f5255 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "test": "vitest", "test:bun": "bun run vitest", "start": "rollup -w -c", - "build": "rm -rf dist && rollup -c && ./fix-optional-dep-types.sh", + "build": "rm -rf dist && rollup -c", "generate:open-api": "./generate-openapi.sh", "lint": "eslint **/*.ts", "lint:fix": "eslint --fix **/*.ts",