Skip to content

Commit

Permalink
v2 API changes (#118)
Browse files Browse the repository at this point in the history
* Replace jsonwebtoken with jose (#115)

* merge main

* Cleanup & Lint

* fix tests

* fix dependencies

* fix tests

* update protobuf lib

* move await

* address comments

* fix tests

---------

Co-authored-by: Mohammad Rasim <[email protected]>

* Use protobuf-es (#116)

* merge main

* Cleanup & Lint

* fix tests

* fix dependencies

* fix tests

* update protobuf lib

* use protobuf-es

* change package type to ESM and use vitest to support tests with ESM

* Use fully specified imports everywhere

* cleanup deps

* cleanup deps

---------

Co-authored-by: Mohammad Rasim <[email protected]>

* add changesets as publishing workflow

* add changeset command

* require node 18 as minimum

* fix eslint

* Add changesets

* Update happy-badgers-call.md

* remove legacy publishing workflow

* update protocol

* more changesets

---------

Co-authored-by: Mohammad Rasim <[email protected]>
  • Loading branch information
lukasIO and moham96 authored Dec 6, 2023
1 parent 9dd604f commit d166b71
Show file tree
Hide file tree
Showing 38 changed files with 8,533 additions and 18,167 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@livekit/changesets-changelog-github", { "repo": "livekit/server-sdk-js" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/funny-meals-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': major
---

Change module type to ESM
5 changes: 5 additions & 0 deletions .changeset/happy-badgers-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': major
---

Require node 18 as minimum version
5 changes: 5 additions & 0 deletions .changeset/orange-starfishes-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': major
---

Token generation is now async (replaced jsonwebtoken with jose for better JS runtime support)
5 changes: 5 additions & 0 deletions .changeset/tame-wolves-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': major
---

Replace protobufjs with protobuf-es
File renamed without changes.
43 changes: 19 additions & 24 deletions .github/workflows/publish.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
name: Publish
name: Release

# Controls when the action will run.
on:
workflow_dispatch:
push:
# branches: [ main ]
# only publish on version tags
tags:
- v*
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
docs:
# The type of runner that the job will run on
release:
name: Release
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
Expand All @@ -29,21 +24,21 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build Docs
if: steps.changesets.outputs.published == 'true'
run: pnpm build-docs

- name: Publish to npm
run: |
npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: S3 Upload
if: steps.changesets.outputs.published == 'true'
run: aws s3 cp docs/ s3://livekit-docs/server-sdk-js --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }}
Expand Down
19 changes: 1 addition & 18 deletions generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,4 @@ set -e

rm -rf ./src/proto/*

OPTS="esModuleInterop=true,useOptionals=all,outputClientImpl=false"
# ts-proto has a bug when generating timestamp fields
MODEL_OPTS="esModuleInterop=true,useOptionals=messages,outputClientImpl=false"

# Generate all protos for the browser
protoc --plugin="./node_modules/ts-proto/protoc-gen-ts_proto" \
--ts_proto_out="./src/proto" \
--ts_proto_opt="${OPTS}" \
-I"./protocol/" \
./protocol/livekit_egress.proto ./protocol/livekit_room.proto ./protocol/livekit_webhook.proto

# Generate model to ensure it doesn't have optional timestamps
protoc --plugin="./node_modules/ts-proto/protoc-gen-ts_proto" \
--ts_proto_out="./src/proto" \
--ts_proto_opt="${MODEL_OPTS}" \
-I"./protocol/" \
./protocol/livekit_models.proto

protoc --es_out src/proto --es_opt target=ts -I./protocol ./protocol/livekit_egress.proto ./protocol/livekit_ingress.proto ./protocol/livekit_room.proto ./protocol/livekit_webhook.proto ./protocol/livekit_models.proto
4 changes: 0 additions & 4 deletions jest.config.js

This file was deleted.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@
"repository": "[email protected]:livekit/server-sdk-js.git",
"author": "David Zhao <[email protected]>",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"build": "tsc",
"build": "tsc --project tsconfig.json",
"build:watch": "tsc --watch",
"build-docs": "typedoc",
"changeset": "changeset",
"ci:publish": "pnpm build && changeset publish",
"proto": "./generate-proto.sh",
"lint": "eslint .",
"format": "prettier --write src",
"format:check": "prettier --check src",
"prepare": "pnpm build",
"test": "jest"
"test": "vitest run"
},
"dependencies": {
"@bufbuild/protobuf": "^1.3.0",
"camelcase-keys": "^7.0.0",
"jsonwebtoken": "^9.0.0",
"long": "^5.0.0",
"protobufjs": "^7.2.4"
"jose": "^5.1.2"
},
"devDependencies": {
"@types/jest": "^26.0.20",
"@types/jsonwebtoken": "^9.0.0",
"@bufbuild/protoc-gen-es": "^1.3.0",
"@changesets/cli": "^2.27.1",
"@types/node": "^20.10.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.24.0",
"jest": "^26.6.3",
"prettier": "^2.6.2",
"ts-jest": "^26.4.4",
"ts-loader": "^8.0.11",
"ts-node": "^9.1.1",
"ts-proto": "^1.131.0",
"typedoc": "^0.22.13",
"typescript": "4.2.x",
"webpack": "^5.9.0",
"webpack-cli": "^4.2.0"
"typedoc": "^0.25.4",
"typescript": "4.6.x",
"vite": "^5.0.5",
"vitest": "^0.34.6"
},
"engines": {
"node": ">=18"
}
}
Loading

0 comments on commit d166b71

Please sign in to comment.