jbilcke-hf HF staff commited on
Commit
3a25c0b
1 Parent(s): 080ac9d

upgrade dependencies, investigate the electron build

Browse files
.nvmrc CHANGED
@@ -1 +1 @@
1
- v20.9.0
 
1
+ v20.15.1
README.md CHANGED
@@ -70,11 +70,12 @@ As a prerequisite you need to have [git lfs](https://git-lfs.com/) installed (se
70
  git lfs install
71
  ```
72
 
73
- Clapper has been tested with Node `20.9.*`.
74
 
75
  To make sure you use this version, you can use [NVM](https://github.com/nvm-sh/nvm) to activate it:
76
 
77
  ```bash
 
78
  nvm use
79
  ```
80
 
 
70
  git lfs install
71
  ```
72
 
73
+ Clapper has been tested with Node `20.15.1`.
74
 
75
  To make sure you use this version, you can use [NVM](https://github.com/nvm-sh/nvm) to activate it:
76
 
77
  ```bash
78
+ nvm install
79
  nvm use
80
  ```
81
 
forge.config.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ packagerConfig: {
3
+ asar: false, // true,
4
+ icon: "./public/icon",
5
+ osxSign: {}
6
+ },
7
+ rebuildConfig: {},
8
+ makers: [
9
+ {
10
+ name: '@electron-forge/maker-squirrel',
11
+ config: {},
12
+ },
13
+ {
14
+ name: '@electron-forge/maker-zip',
15
+ platforms: ['darwin'],
16
+ },
17
+ {
18
+ name: '@electron-forge/maker-deb',
19
+ config: {
20
+ options: {
21
+ icon: './public/icon.png'
22
+ }
23
+ },
24
+ },
25
+ {
26
+ name: '@electron-forge/maker-dmg',
27
+ config: {
28
+ options: {
29
+ icon: './public/icon.icns'
30
+ }
31
+ },
32
+ },
33
+ {
34
+ name: '@electron-forge/maker-rpm',
35
+ config: {},
36
+ },
37
+ ],
38
+ plugins: [
39
+ /*
40
+ Only needed if asar is set to true
41
+ {
42
+ name: '@electron-forge/plugin-auto-unpack-natives',
43
+ config: {},
44
+ },
45
+ */
46
+ ],
47
+ };
main.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+ const dotenv = require('dotenv')
4
+
5
+ dotenv.config()
6
+
7
+ try {
8
+ if (fs.existsSync(".env.local")) {
9
+ const result = dotenv.config({ path: ".env.local" })
10
+ console.log("using .env.local")
11
+ process.env = {
12
+ ...process.env,
13
+ ...result.parsed,
14
+ }
15
+ }
16
+ } catch (err) {
17
+ // do nothing
18
+ console.log("using .env")
19
+ }
20
+
21
+ const { app, BrowserWindow, screen } = require('electron')
22
+
23
+ const currentDir = process.cwd()
24
+
25
+ const mainServerPath = path.join(currentDir, '.next/standalone/server.js')
26
+
27
+ // now we load the main server
28
+ require(mainServerPath)
29
+
30
+ const voiceServerPath = path.join(currentDir, '.next/standalone/voice-server.js')
31
+
32
+ // now we load the voice server
33
+ require(voiceServerPath)
34
+
35
+
36
+ const createWindow = () => {
37
+ const mainScreen = screen.getPrimaryDisplay()
38
+ const allScreens = screen.getAllDisplays()
39
+ console.log("debug:", {
40
+ mainScreen,
41
+ allScreens
42
+ })
43
+
44
+ const mainWindow = new BrowserWindow({
45
+ // copy the width and height
46
+ ...mainScreen.workAreaSize,
47
+
48
+ icon: './public/icon.png'
49
+ })
50
+
51
+ mainWindow.loadURL('http://0.0.0.0:3000/')
52
+
53
+ mainWindow.on('closed', () => {
54
+ app.quit()
55
+ })
56
+ }
57
+
58
+ app.whenReady().then(() => {
59
+
60
+ createWindow()
61
+ })
62
+
63
+ app.on('window-all-closed', () => {
64
+ if (process.platform !== 'darwin') {
65
+ app.quit()
66
+ }
67
+ })
next.config.js CHANGED
@@ -1,5 +1,7 @@
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
 
 
3
  experimental: {
4
  serverActions: {
5
  // a clap file can be quite large - but that's OK
@@ -40,7 +42,7 @@ const nextConfig = {
40
  // matching ALL routes
41
  source: "/:path*",
42
  headers: [
43
- // for security reasons, performance.now() not performant unless we disable some CORS stuff
44
  // more context about why, please check the Security paragraph here:
45
  // https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#security_requirements
46
  { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
 
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
+ // output: 'standalone',
4
+
5
  experimental: {
6
  serverActions: {
7
  // a clap file can be quite large - but that's OK
 
42
  // matching ALL routes
43
  source: "/:path*",
44
  headers: [
45
+ // for security reasons, performance.now() is not performant unless we disable some CORS stuff
46
  // more context about why, please check the Security paragraph here:
47
  // https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#security_requirements
48
  { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -16,7 +16,11 @@
16
  "test": "npm run build && npm run test:unit:ci && npm run test:e2e",
17
  "test:unit:ci": "vitest run",
18
  "test:unit:watch": "vitest",
19
- "test:e2e": "npx playwright test"
 
 
 
 
20
  },
21
  "dependencies": {
22
  "@aitube/broadway": "0.0.22",
@@ -27,16 +31,16 @@
27
  "@fal-ai/serverless-client": "^0.13.0",
28
  "@ffmpeg/ffmpeg": "^0.12.10",
29
  "@ffmpeg/util": "^0.12.1",
30
- "@gradio/client": "^1.1.1",
31
  "@huggingface/hub": "^0.15.1",
32
- "@huggingface/inference": "^2.7.0",
33
- "@langchain/anthropic": "^0.2.2",
34
- "@langchain/cohere": "^0.1.0",
35
- "@langchain/core": "^0.2.9",
36
- "@langchain/google-vertexai": "^0.0.19",
37
- "@langchain/groq": "^0.0.13",
38
- "@langchain/mistralai": "^0.0.24",
39
- "@langchain/openai": "^0.2.0",
40
  "@monaco-editor/react": "^4.6.0",
41
  "@radix-ui/react-accordion": "^1.1.2",
42
  "@radix-ui/react-avatar": "^1.0.4",
@@ -66,8 +70,6 @@
66
  "@react-three/uikit-lucide": "^0.3.4",
67
  "@tailwindcss/container-queries": "^0.1.1",
68
  "@types/dom-speech-recognition": "^0.0.4",
69
- "@upstash/ratelimit": "^1.1.3",
70
- "@upstash/redis": "^1.31.1",
71
  "@xenova/transformers": "github:xenova/transformers.js#v3",
72
  "autoprefixer": "10.4.19",
73
  "class-variance-authority": "^0.7.0",
@@ -98,10 +100,10 @@
98
  "react-icons": "^5.2.1",
99
  "react-reflex": "^4.2.6",
100
  "react-speakup": "^1.0.0",
101
- "replicate": "^0.30.2",
102
  "sharp": "^0.33.4",
103
  "sonner": "^1.5.0",
104
- "tailwind-merge": "^2.3.0",
105
  "tailwindcss-animate": "^1.0.7",
106
  "three": "^0.164.1",
107
  "ts-node": "^10.9.2",
@@ -114,6 +116,13 @@
114
  "zx": "^8.1.3"
115
  },
116
  "devDependencies": {
 
 
 
 
 
 
 
117
  "@playwright/test": "^1.45.1",
118
  "@testing-library/react": "^16.0.0",
119
  "@types/fluent-ffmpeg": "^2.1.24",
@@ -123,6 +132,7 @@
123
  "@types/react-dom": "^18",
124
  "@types/uuid": "^9.0.8",
125
  "@vitejs/plugin-react": "^4.3.1",
 
126
  "eslint": "^8",
127
  "eslint-config-next": "14.2.5",
128
  "eslint-config-prettier": "^9.1.0",
 
16
  "test": "npm run build && npm run test:unit:ci && npm run test:e2e",
17
  "test:unit:ci": "vitest run",
18
  "test:unit:watch": "vitest",
19
+ "test:e2e": "npx playwright test",
20
+ "electron": "electron .",
21
+ "electron:start": "electron-forge start",
22
+ "electron:package": "electron-forge package",
23
+ "electron:make": "electron-forge make"
24
  },
25
  "dependencies": {
26
  "@aitube/broadway": "0.0.22",
 
31
  "@fal-ai/serverless-client": "^0.13.0",
32
  "@ffmpeg/ffmpeg": "^0.12.10",
33
  "@ffmpeg/util": "^0.12.1",
34
+ "@gradio/client": "^1.3.0",
35
  "@huggingface/hub": "^0.15.1",
36
+ "@huggingface/inference": "^2.8.0",
37
+ "@langchain/anthropic": "^0.2.6",
38
+ "@langchain/cohere": "^0.2.1",
39
+ "@langchain/core": "^0.2.17",
40
+ "@langchain/google-vertexai": "^0.0.20",
41
+ "@langchain/groq": "^0.0.15",
42
+ "@langchain/mistralai": "^0.0.26",
43
+ "@langchain/openai": "^0.2.4",
44
  "@monaco-editor/react": "^4.6.0",
45
  "@radix-ui/react-accordion": "^1.1.2",
46
  "@radix-ui/react-avatar": "^1.0.4",
 
70
  "@react-three/uikit-lucide": "^0.3.4",
71
  "@tailwindcss/container-queries": "^0.1.1",
72
  "@types/dom-speech-recognition": "^0.0.4",
 
 
73
  "@xenova/transformers": "github:xenova/transformers.js#v3",
74
  "autoprefixer": "10.4.19",
75
  "class-variance-authority": "^0.7.0",
 
100
  "react-icons": "^5.2.1",
101
  "react-reflex": "^4.2.6",
102
  "react-speakup": "^1.0.0",
103
+ "replicate": "^0.31.1",
104
  "sharp": "^0.33.4",
105
  "sonner": "^1.5.0",
106
+ "tailwind-merge": "^2.4.0",
107
  "tailwindcss-animate": "^1.0.7",
108
  "three": "^0.164.1",
109
  "ts-node": "^10.9.2",
 
116
  "zx": "^8.1.3"
117
  },
118
  "devDependencies": {
119
+ "@electron-forge/cli": "^7.4.0",
120
+ "@electron-forge/maker-deb": "^7.4.0",
121
+ "@electron-forge/maker-dmg": "^7.4.0",
122
+ "@electron-forge/maker-rpm": "^7.4.0",
123
+ "@electron-forge/maker-squirrel": "^7.4.0",
124
+ "@electron-forge/maker-zip": "^7.4.0",
125
+ "@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
126
  "@playwright/test": "^1.45.1",
127
  "@testing-library/react": "^16.0.0",
128
  "@types/fluent-ffmpeg": "^2.1.24",
 
132
  "@types/react-dom": "^18",
133
  "@types/uuid": "^9.0.8",
134
  "@vitejs/plugin-react": "^4.3.1",
135
+ "electron": "^31.2.1",
136
  "eslint": "^8",
137
  "eslint-config-next": "14.2.5",
138
  "eslint-config-prettier": "^9.1.0",
src/services/broadcast/useBroadcast.ts CHANGED
@@ -7,10 +7,10 @@ import { getDefaultBroadcastState } from './getDefaultBroadcastState'
7
 
8
  /**
9
  * Service to manage streaming
10
- *
11
- * Ideally this should be down on the client side, to keep the backend
12
  * able to scale to thousand of users
13
- *
14
  * Here are some useful pointers and discussions regarding client-side:
15
  * - https://github.com/ffmpegwasm/ffmpeg.wasm/issues/100
16
  * - https://github.com/Kagami/ffmpeg.js/pull/166
 
7
 
8
  /**
9
  * Service to manage streaming
10
+ *
11
+ * Ideally this should be down on the client side, to keep the backend
12
  * able to scale to thousand of users
13
+ *
14
  * Here are some useful pointers and discussions regarding client-side:
15
  * - https://github.com/ffmpegwasm/ffmpeg.wasm/issues/100
16
  * - https://github.com/Kagami/ffmpeg.js/pull/166