Skip to content

Commit

Permalink
chore: add vercel deployment and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko committed Aug 8, 2024
1 parent e2dbd49 commit 9d62638
Show file tree
Hide file tree
Showing 6 changed files with 1,908 additions and 230 deletions.
1 change: 1 addition & 0 deletions examples/vite/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.vercel
27 changes: 27 additions & 0 deletions examples/vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Deploying the Threads Demo

1. Build and link `stream-chat` and `stream-chat-css` from the `feat/threads-v2` branch
2. Build this demo app:

```sh
yarn build
```

3. Link to the demo Vercel project and pull default environment variables:

```sh
yarn vercel link --yes --scope getstreamio --project stream-threads-demo
yarn vercel pull
```

4. Deploy:

```sh
yarn vercel deploy
```

The deployed app will use the app, user and token specified in Vercel environment variables. You can override these values in URL search params:

- `key` to override app key
- `uid` to override user id
- `ut` to override token
1 change: 1 addition & 0 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eslint-plugin-react-refresh": "^0.4.6",
"sass": "^1.75.0",
"typescript": "^5.4.5",
"vercel": "^35.2.3",
"vite": "^5.2.10"
}
}
3 changes: 1 addition & 2 deletions examples/vite/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { useMemo } from 'react';
import { ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat';
import {
Channel,
Expand All @@ -20,7 +19,7 @@ const params = (new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, property) => searchParams.get(property as string),
}) as unknown) as Record<string, string | null>;

const apiKey = import.meta.env.VITE_STREAM_KEY as string;
const apiKey = params.key ?? (import.meta.env.VITE_STREAM_KEY as string);
const userId = params.uid ?? (import.meta.env.VITE_USER_ID as string);
const userToken = params.ut ?? (import.meta.env.VITE_USER_TOKEN as string);

Expand Down
1 change: 0 additions & 1 deletion examples/vite/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import './index.scss';
Expand Down
Loading

0 comments on commit 9d62638

Please sign in to comment.