Skip to content

Commit 5d4477b

Browse files
committed
fix(zerops): fix build backend + frontend
1 parent 8f1ea9e commit 5d4477b

File tree

6 files changed

+17
-37
lines changed

6 files changed

+17
-37
lines changed

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
strict-peer-dependencies=false
22
auto-install-peers=true
33
ignore-workspace-root-check=true
4+
node-linker=hoisted
5+
symlink=false

apps/coursition-new-rs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"dependencies": {
1111
"react": "^19.0.0-rc.1",
1212
"react-dom": "^19.0.0-rc.1",
13-
"@preact/signals-react": "^2.2.0",
1413
"@vidstack/react": "^1.12.12"
1514
},
1615
"devDependencies": {

apps/coursition-new-rs/src/App.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { treaty } from '@elysiajs/eden'
22
import { Button, Input, Tabs, Textarea } from '@nmit-coursition/ui/design-system'
33
import { convertSubtitlesToBlob } from '@nmit-coursition/utils'
4-
import { useSignal } from '@preact/signals-react'
5-
import { useActionState } from 'react'
4+
import { useActionState, useState } from 'react'
65
import { toast } from 'sonner'
76
import { z } from 'zod'
87
import { zfd } from 'zod-form-data'
@@ -44,19 +43,19 @@ const statusStates = [
4443
]
4544

4645
export default function Index() {
47-
const status = useSignal<'idle' | 'upload' | 'parse' | 'done'>('idle')
46+
const [status, setStatus] = useState<'idle' | 'upload' | 'parse' | 'done'>('idle')
4847

4948
const handleSubmit = async (formData: FormData) => {
5049
try {
51-
status.value = 'upload'
50+
setStatus('upload')
5251

5352
const rawFormData = Object.fromEntries(formData.entries())
5453
const type = formData.has('file') ? 'file' : 'url'
5554
const parsedData = fileSchema.parse({ type, ...rawFormData })
5655

5756
const videoSource = parsedData.type === 'file' ? URL.createObjectURL(parsedData.file) : parsedData.url
5857

59-
status.value = 'parse'
58+
setStatus('parse')
6059
const keywordsArray = parsedData.keywords ? parsedData.keywords.split(',').map((word) => `${word}:5`) : []
6160
const output: ('text' | 'vtt' | 'srt')[] = ['text', 'srt', 'vtt']
6261

@@ -88,11 +87,11 @@ export default function Index() {
8887

8988
if (error) throw new Error(error.value.description)
9089
const { text, srt, vtt } = data
91-
status.value = 'done'
90+
setStatus('done')
9291
return { raw: text, srt, vtt, videoSource }
9392
} catch (error) {
9493
toast.error(`Something went wrong. Reason: ${error instanceof Error ? error.message : 'Unknown.'}`)
95-
status.value = 'idle'
94+
setStatus('idle')
9695
return initialState
9796
}
9897
}
@@ -102,7 +101,7 @@ export default function Index() {
102101
return (
103102
<div className='flex justify-center h-screen'>
104103
<div className='p-4 max-w-2xl w-full'>
105-
{status.value === 'idle' && (
104+
{status === 'idle' && (
106105
<>
107106
<h1 className='text-2xl font-bold mb-4'>Upload media</h1>
108107
<form className='space-y-4' action={formAction}>
@@ -157,10 +156,8 @@ export default function Index() {
157156
</form>
158157
</>
159158
)}
160-
{status.value !== 'idle' && status.value !== 'done' && (
161-
<StatusDisplay states={statusStates} status={status.value} />
162-
)}
163-
{status.value === 'done' && (
159+
{status !== 'idle' && status !== 'done' && <StatusDisplay states={statusStates} status={status} />}
160+
{status === 'done' && (
164161
<Tabs
165162
listClassName='h-auto'
166163
triggerClassName='text-lg m-1'

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"@infisical/sdk": "^3.0.3",
3131
"@lemonsqueezy/lemonsqueezy.js": "^4.0.0",
3232
"@mendable/firecrawl-js": "^1.8.4",
33-
"@preact/signals-react": "^2.2.0",
3433
"@prisma/client": "^5.22.0",
3534
"@radix-ui/react-accordion": "^1.2.1",
3635
"@radix-ui/react-checkbox": "^1.1.2",
@@ -108,5 +107,8 @@
108107
"@nx/workspace": "20.1.2",
109108
"nx": "20.1.2",
110109
"@sinclair/typebox": "0.34.3"
110+
},
111+
"prisma": {
112+
"schema": "./libs/db/src/schema.prisma"
111113
}
112114
}

pnpm-lock.yaml

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zerops.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ zerops:
1919
- echo "Upgrading bun to 1.1.38"
2020
- bun upgrade
2121
buildCommands:
22-
- pnpm install
22+
- pnpm install --frozen-lockfile --prefer-offline --prod=false
2323
- bun run postinstall
2424
- bun run validateEnv
25-
- bun x nx build:executable backend --verbose --skip-nx-cache
26-
- ls apps/backend
25+
- pnpm nx build:executable backend --verbose --skip-nx-cache
2726
deployFiles:
2827
- apps/backend/dist
2928
- node_modules/.prisma
@@ -47,7 +46,7 @@ zerops:
4746
- echo "Installing yt-dlp"
4847
- curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/bin/yt-dlp
4948
- chmod a+rx /usr/bin/yt-dlp # Make executable
50-
start: apps/backend/dist/main
49+
start: PRISMA_QUERY_ENGINE_LIBRARY=./node_modules/prisma; apps/backend/dist/main
5150

5251
deploy:
5352
readinessCheck:

0 commit comments

Comments
 (0)