Skip to content

Commit

Permalink
FCE-883 / Bundle webrtc package in ts-client (#186)
Browse files Browse the repository at this point in the history
## Description

Configure TSUP to bundle webrtc client in the ts client.
Additionally add `protobufs` package and store the protobufs there,
instead of keeping them in `ts-client`.

## Motivation and Context

This allows to release `ts-client` without publishing `webrtc-client`.

## Types of changes

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to
      not work as expected)
  • Loading branch information
czerwiukk authored Nov 26, 2024
1 parent 7ea2029 commit 5e200dd
Show file tree
Hide file tree
Showing 21 changed files with 7,825 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install node dependencies
Expand All @@ -46,4 +48,4 @@ jobs:
path: "docs"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v2
5 changes: 4 additions & 1 deletion .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: "npm"

- name: Install Protoc
uses: arduino/setup-protoc@v3

- name: Install dependencies ⬇️
run: yarn --immutable
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
with:
node-version: 20
cache: npm

- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Install dependencies ⬇️
run: yarn --immutable

Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ jobs:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Install Protoc
uses: arduino/setup-protoc@v3
- run: yarn
- run: yarn build
- run: yarn npm publish --access public
- run: yarn npm publish --access public
working-directory: packages/ts-client
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -31,11 +34,11 @@ jobs:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: yarn
- run: yarn build
- run: yarn npm publish --access public
- run: yarn npm publish --access public
working-directory: packages/react-client
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 2 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "packages/ts-client/protos"]
path = packages/ts-client/protos
[submodule "packages/protobufs/protos"]
path = packages/protobufs/protos
url = https://github.com/fishjam-cloud/protos.git
branch = master
1 change: 1 addition & 0 deletions e2e-tests/ts-client/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"preview": "vite preview"
},
"dependencies": {
"@fishjam-cloud/protobufs": "workspace:*",
"@fishjam-cloud/ts-client": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
8 changes: 5 additions & 3 deletions e2e-tests/ts-client/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
BandwidthLimit,
SimulcastConfig,
} from "@fishjam-cloud/ts-client";
import { WebRTCEndpoint } from "@fishjam-cloud/ts-client";
import { PeerMessage } from "@fishjam-cloud/ts-client/protos";
import { WebRTCEndpoint, sdkVersion } from "@fishjam-cloud/ts-client";
import { PeerMessage } from "@fishjam-cloud/protobufs/fishjamPeer";
import { useEffect, useState, useSyncExternalStore } from "react";
import { MockComponent } from "./MockComponent";
import { VideoPlayerWithDetector } from "./VideoPlayerWithDetector";
Expand Down Expand Up @@ -101,7 +101,9 @@ function connect(token: string, metadata: EndpointMetadata) {
websocket.binaryType = "arraybuffer";

function socketOpenHandler(_event: Event) {
const message = PeerMessage.encode({ authRequest: { token } }).finish();
const message = PeerMessage.encode({
authRequest: { token, sdkVersion },
}).finish();
websocket.send(message);
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"license": "MIT",
"private": true,
"workspaces": [
"packages/protobufs",
"packages/webrtc-client",
"packages/ts-client",
"packages/react-client",
"packages/webrtc-client",
"examples/ts-client/*",
"examples/react-client/*",
"e2e-tests/ts-client/app",
Expand Down
Loading

0 comments on commit 5e200dd

Please sign in to comment.