Skip to content

Commit 8348816

Browse files
authored
Replace yarn with pnpm (#696)
1 parent c369bba commit 8348816

28 files changed

+14812
-13567
lines changed

.changeset/thick-keys-happen.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@livekit/components-react": patch
3+
4+
---
5+
6+
Export isTrackReference

.github/workflows/release.yaml

+10-13
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,23 @@ jobs:
1212
name: Release
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Checkout Repo
16-
uses: actions/checkout@v4
17-
18-
- name: Setup Node.js 20.x
15+
- uses: actions/checkout@v4
16+
- uses: pnpm/action-setup@v2
17+
with:
18+
version: 8
19+
- name: Use Node.js 20
1920
uses: actions/setup-node@v4
2021
with:
21-
node-version: 20.x
22-
env:
23-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
24-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25-
26-
- name: Install Dependencies
27-
run: yarn
28-
22+
node-version: 20
23+
cache: 'pnpm'
24+
- name: Install dependencies
25+
run: pnpm install
2926
- name: Create Release Pull Request or Publish to npm
3027
id: changesets
3128
uses: changesets/action@v1
3229
with:
3330
# This expects you to have a script called release which does a build for your packages and calls changeset publish
34-
publish: yarn release
31+
publish: pnpm publish
3532
env:
3633
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3734
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/size-limit.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ jobs:
1111
CI_JOB_NUMBER: 1
1212
steps:
1313
- uses: actions/checkout@v4
14+
- uses: pnpm/action-setup@v2
15+
with:
16+
version: 8
17+
- name: Use Node.js 20
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: 'pnpm'
22+
- name: Install dependencies
23+
run: pnpm install
1424
- uses: andresz1/[email protected]
1525
with:
1626
github_token: ${{ secrets.GITHUB_TOKEN }}
1727
script: npx -w @livekit/components-react size-limit --json
18-
package_manager: yarn
28+
package_manager: pnpm
1929
build_script: build:react

.github/workflows/test.yaml

+14-14
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ jobs:
1616
with:
1717
fetch-depth: 2
1818

19-
- uses: actions/setup-node@v4
19+
- uses: pnpm/action-setup@v2
2020
with:
21-
node-version: '20.x'
22-
cache: 'yarn'
23-
24-
- name: Install Yarn
25-
run: |
26-
npm install -g yarn
27-
yarn install
28-
21+
version: 8
22+
- name: Use Node.js 20
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: 'pnpm'
27+
- name: Install dependencies
28+
run: pnpm install
2929
- name: ESLint
30-
run: yarn lint
30+
run: pnpm lint
3131

3232
- name: Prettier
33-
run: yarn format:check
33+
run: pnpm format:check
3434

3535
- name: Build Packages
36-
run: yarn build
36+
run: pnpm build
3737

3838
- name: Run Tests
39-
run: yarn test
39+
run: pnpm test
4040

4141
- name: Check for API Changes
42-
run: yarn api:check
42+
run: pnpm api:check

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ If you are interested in contributing to the project or running the examples tha
5959
### Setup Monorepo
6060

6161
This repo consists of multiple packages that partly build on top of each other.
62-
It relies on yarn workspaces and [Turborepo](https://turbo.build/repo/docs) (which gets installed automatically).
62+
It relies on pnpm workspaces and [Turborepo](https://turbo.build/repo/docs) (which gets installed automatically).
6363

64-
Clone the repo and run `yarn install` the root level:
64+
Clone the repo and run `pnpm install` the root level:
6565

6666
```shell
67-
yarn install
67+
pnpm install
6868
```
6969

7070
In order to link up initial dependencies and check whether everything has installed correctly run
7171

7272
```shell
73-
yarn build
73+
pnpm build
7474
```
7575

7676
This will build all the packages in `/packages` and the examples in `/examples` once.
@@ -79,7 +79,7 @@ After that you can use a more granular command to only rebuild the packages you
7979
E.g. to test and automatically rebuild package dependencies for the nextjs example, run:
8080

8181
```shell
82-
yarn dev:next
82+
pnpm dev:next
8383
```
8484

8585
> **Note**

docs/storybook/.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ VITE_PUBLIC_TEST_TOKEN=
77

88
# STORYBOOK
99
# https://storybook.js.org/docs/react/configure/telemetry#how-to-opt-out
10-
STORYBOOK_DISABLE_TELEMETRY="1 yarn storybook"
10+
STORYBOOK_DISABLE_TELEMETRY="1 pnpm storybook"

docs/storybook/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This Storybook gives a good overview over all* (*work in progress) LiveKit compo
2323
2. From the root of the monorepo run:
2424

2525
```bash
26-
yarn dev:storybook
26+
pnpm dev:storybook
2727
```
2828

2929
This should open storybook in the default browser under `http://localhost:6006`

docs/storybook/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@storybook/addon-essentials": "^7.0.0-beta.30",
2323
"@storybook/addon-interactions": "^7.0.0-beta.30",
2424
"@storybook/addon-links": "^7.0.0-beta.30",
25+
"@storybook/addon-docs": "^7.0.0-beta.30",
2526
"@storybook/react": "^7.0.0-beta.30",
2627
"@storybook/react-vite": "7.5.2",
2728
"@storybook/testing-library": "^0.2.0",

examples/nextjs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Copy the the contents of `.env.example` in to a newly created `.env.local` file
2828
With everything setup we can now start the Next.js-App from the root of the monorepo with:
2929

3030
```bash
31-
yarn dev:next
31+
pnpm dev:next
3232
```
3333

3434
Navigate to `http://localhost:3000/` to see a list of examples to choose from.

examples/nextjs/pages/customize.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
ParticipantName,
44
TrackMutedIndicator,
55
RoomAudioRenderer,
6+
isTrackReference,
67
useConnectionQualityIndicator,
78
VideoTrack,
89
useToken,
@@ -16,7 +17,6 @@ import styles from '../styles/Simple.module.css';
1617
import myStyles from '../styles/Customize.module.css';
1718
import type { NextPage } from 'next';
1819
import { HTMLAttributes, useState } from 'react';
19-
import { isTrackReference } from '@livekit/components-core';
2020
import { generateRandomUserId } from '../lib/helper';
2121

2222
const CustomizeExample: NextPage = () => {

package.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,16 @@
1616
"format:check": "prettier --check \"**/src/**/*.{ts,tsx,md}\"",
1717
"format:write": "prettier --write \"**/src/**/*.{ts,tsx,md}\"",
1818
"gen:docs": "turbo run gen:docs",
19-
"gen:docs:watch": "nodemon --watch \"tooling/api-documenter/src/**/*\" --watch \"packages/react/src/**/*\" --ignore \"packages/react/src/assets/**/*\" -e js,jsx,ts,tsx -x \"yarn gen:docs\"",
19+
"gen:docs:watch": "nodemon --watch \"tooling/api-documenter/src/**/*\" --watch \"packages/react/src/**/*\" --ignore \"packages/react/src/assets/**/*\" -e js,jsx,ts,tsx -x \"pnpm gen:docs\"",
2020
"lint": "turbo run lint",
21-
"release": "turbo run build --filter=./packages/* && changeset publish",
21+
"publish": "turbo run build --filter=./packages/* && pnpm --filter=./packages/* publish",
2222
"start:next": "turbo run start --filter=@livekit/component-example-next...",
2323
"test": "turbo run test",
2424
"tooling:update-readme-nav": "node tooling/readme-manager/update-nav-in-readmes.js",
2525
"api:check": "turbo run api-check",
2626
"api-extractor": "turbo run api-extractor",
2727
"cleanup": "find . -type d \\( -name 'node_modules' -o -name '.turbo' -o -name 'dist' \\) -prune -exec rm -rf '{}' +"
2828
},
29-
"workspaces": [
30-
"packages/*",
31-
"examples/*",
32-
"docs/*",
33-
"tooling/*"
34-
],
3529
"dependencies": {},
3630
"peerDependencies": {
3731
"typescript": "5.1.6"

packages/core/.github/workflows/main.yml

-32
This file was deleted.

packages/core/.github/workflows/size.yml

-12
This file was deleted.

packages/core/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
"rxjs": "^7.8.0"
4242
},
4343
"peerDependencies": {
44-
"livekit-client": "^1.12.0"
44+
"livekit-client": "^1.12.0",
45+
"tslib": "^2.6.2"
4546
},
4647
"devDependencies": {
47-
"@livekit/components-styles": "~1.0.6",
48+
"@livekit/components-styles": "workspace:../styles",
4849
"@microsoft/api-extractor": "^7.36.0",
4950
"@size-limit/file": "^10.0.0",
5051
"@size-limit/webpack": "^10.0.0",

packages/react/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A LiveKit Components implementation in [React](https://reactjs.org/).
2020
## Install
2121

2222
```bash
23-
yarn install @livekit/components-react
23+
npm install @livekit/components-react
2424
```
2525

2626
## Usage

packages/react/etc/components-react.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type { CreateLocalTracksOptions } from 'livekit-client';
1616
import type { DataSendOptions } from '@livekit/components-core';
1717
import type { GridLayoutDefinition } from '@livekit/components-core';
1818
import { HTMLAttributes } from 'react';
19+
import { isTrackReference } from '@livekit/components-core';
1920
import type { LocalAudioTrack } from 'livekit-client';
2021
import { LocalParticipant } from 'livekit-client';
2122
import type { LocalTrack } from 'livekit-client';
@@ -272,6 +273,8 @@ export interface GridLayoutProps extends React_2.HTMLAttributes<HTMLDivElement>,
272273
tracks: TrackReferenceOrPlaceholder[];
273274
}
274275

276+
export { isTrackReference }
277+
275278
// @public (undocumented)
276279
export const LayoutContext: React_2.Context<LayoutContextType | undefined>;
277280

packages/react/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
"src"
3434
],
3535
"scripts": {
36-
"build": "yarn gen:svg && tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
36+
"build": "pnpm gen:svg && tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
3737
"dev": "tsup --watch --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
3838
"gen:icons": "rimraf -I -g ./src/assets/icons/*Icon.tsx && svgr --template ./src/assets/template.js --out-dir ./src/assets/icons --typescript ../styles/assets/icons",
3939
"gen:images": "rimraf -I -g ./src/assets/images/*.tsx && svgr --template ./src/assets/template.js --out-dir ./src/assets/images --typescript --no-svgo ../styles/assets/images",
40-
"gen:svg": "yarn gen:images && yarn gen:icons",
40+
"gen:svg": "pnpm gen:images && pnpm gen:icons",
4141
"lint": "eslint -f unix \"src/**/*.{ts,tsx}\"",
4242
"test": "vitest --run",
4343
"test:watch": "vitest",
@@ -47,15 +47,16 @@
4747
},
4848
"typings": "dist/index.d.ts",
4949
"dependencies": {
50-
"@livekit/components-core": "0.7.0",
50+
"@livekit/components-core": "workspace:../core",
5151
"@react-hook/latest": "^1.0.3",
5252
"clsx": "^2.0.0",
5353
"usehooks-ts": "^2.9.1"
5454
},
5555
"peerDependencies": {
5656
"livekit-client": "^1.12.0",
5757
"react": ">=18",
58-
"react-dom": ">=18"
58+
"react-dom": ">=18",
59+
"tslib": "^2.6.2"
5960
},
6061
"devDependencies": {
6162
"@microsoft/api-extractor": "^7.35.0",

packages/react/src/hooks/internal/useObservableState.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
// @ts-ignore
23
import type { Observable } from 'rxjs';
34

45
/**

packages/react/src/hooks/useChat.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { MessageDecoder, MessageEncoder } from '@livekit/components-core';
2-
import { setupChat } from '@livekit/components-core';
2+
import { ReceivedChatMessage, setupChat } from '@livekit/components-core';
33
import * as React from 'react';
44
import { useRoomContext } from '../context';
55
import { useObservableState } from './internal/useObservableState';
@@ -18,7 +18,7 @@ export function useChat(options?: {
1818
const room = useRoomContext();
1919
const [setup, setSetup] = React.useState<ReturnType<typeof setupChat>>();
2020
const isSending = useObservableState(setup?.isSendingObservable, false);
21-
const chatMessages = useObservableState(setup?.messageObservable, []);
21+
const chatMessages = useObservableState<ReceivedChatMessage[]>(setup?.messageObservable, []);
2222

2323
React.useEffect(() => {
2424
const setupChatReturn = setupChat(room, options);

packages/react/src/hooks/useMediaDeviceSelect.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function useMediaDeviceSelect({
4444
() => createMediaDeviceObserver(kind, requestPermissions),
4545
[kind, requestPermissions],
4646
);
47-
const devices = useObservableState(deviceObserver, []);
47+
const devices = useObservableState(deviceObserver, [] as MediaDeviceInfo[]);
4848
// Active device management.
4949
const [currentDeviceId, setCurrentDeviceId] = React.useState<string>('');
5050
const { className, activeDeviceObservable, setActiveMediaDevice } = React.useMemo(

packages/react/src/hooks/useMediaDevices.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ import { createMediaDeviceObserver } from '@livekit/components-core';
1414
*/
1515
export function useMediaDevices({ kind }: { kind: MediaDeviceKind }) {
1616
const deviceObserver = React.useMemo(() => createMediaDeviceObserver(kind), [kind]);
17-
const devices = useObservableState(deviceObserver, []);
17+
const devices = useObservableState(deviceObserver, [] as MediaDeviceInfo[]);
1818
return devices;
1919
}

packages/react/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export * from './prefabs';
77
export * from './context';
88

99
// Re-exports from core
10-
export { setLogLevel } from '@livekit/components-core';
10+
export { setLogLevel, isTrackReference } from '@livekit/components-core';
1111
export type {
1212
ChatMessage,
1313
ReceivedChatMessage,

packages/styles/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
],
6666
"scripts": {
6767
"prebuild": "rimraf .temp dist",
68-
"build": "yarn compile:sass && yarn postcss && yarn generate:types",
68+
"build": "pnpm compile:sass && pnpm postcss && pnpm generate:types",
6969
"compile:sass": "sass scss:.temp/general --style compressed",
70-
"dev": "nodemon -e scss,js -x \"yarn build\"",
71-
"generate:types": "yarn generate:types:unprefixed && yarn generate:types:prefixed",
70+
"dev": "nodemon -e scss,js -x \"pnpm build\"",
71+
"generate:types": "pnpm generate:types:unprefixed && pnpm generate:types:prefixed",
7272
"generate:types:prefixed": "cd dist && typed-scss-modules \"**/*.css\" --exportType default --outputFolder ../dist/types --nameFormat kebab",
7373
"generate:types:unprefixed": "cd scss && typed-scss-modules \"**/*.scss\" --exportType default --outputFolder ../dist/types_unprefixed --nameFormat kebab --exportTypeName UnprefixedClassNames",
7474
"postcss": "postcss \".temp/**/*.css\" --base .temp -d ./dist",

0 commit comments

Comments
 (0)