From a5c22da2d78e0e1a2238f1884255a4283a5b3f7c Mon Sep 17 00:00:00 2001 From: Petr Glaser Date: Sat, 30 Nov 2024 19:16:54 +0100 Subject: [PATCH] fix(zerops): fix build backend + frontend --- apps/coursition-new-rs/package.json | 1 - apps/coursition-new-rs/src/App.tsx | 21 +++++++++------------ package.json | 4 +++- pnpm-lock.yaml | 19 ------------------- zerops.yml | 10 +++++----- 5 files changed, 17 insertions(+), 38 deletions(-) diff --git a/apps/coursition-new-rs/package.json b/apps/coursition-new-rs/package.json index 70a5003c..e68769a1 100644 --- a/apps/coursition-new-rs/package.json +++ b/apps/coursition-new-rs/package.json @@ -10,7 +10,6 @@ "dependencies": { "react": "^19.0.0-rc.1", "react-dom": "^19.0.0-rc.1", - "@preact/signals-react": "^2.2.0", "@vidstack/react": "^1.12.12" }, "devDependencies": { diff --git a/apps/coursition-new-rs/src/App.tsx b/apps/coursition-new-rs/src/App.tsx index 306c1dc8..cdeab161 100644 --- a/apps/coursition-new-rs/src/App.tsx +++ b/apps/coursition-new-rs/src/App.tsx @@ -1,8 +1,7 @@ import { treaty } from '@elysiajs/eden' import { Button, Input, Tabs, Textarea } from '@nmit-coursition/ui/design-system' import { convertSubtitlesToBlob } from '@nmit-coursition/utils' -import { useSignal } from '@preact/signals-react' -import { useActionState } from 'react' +import { useActionState, useState } from 'react' import { toast } from 'sonner' import { z } from 'zod' import { zfd } from 'zod-form-data' @@ -44,11 +43,11 @@ const statusStates = [ ] export default function Index() { - const status = useSignal<'idle' | 'upload' | 'parse' | 'done'>('idle') + const [status, setStatus] = useState<'idle' | 'upload' | 'parse' | 'done'>('idle') const handleSubmit = async (formData: FormData) => { try { - status.value = 'upload' + setStatus('upload') const rawFormData = Object.fromEntries(formData.entries()) const type = formData.has('file') ? 'file' : 'url' @@ -56,7 +55,7 @@ export default function Index() { const videoSource = parsedData.type === 'file' ? URL.createObjectURL(parsedData.file) : parsedData.url - status.value = 'parse' + setStatus('parse') const keywordsArray = parsedData.keywords ? parsedData.keywords.split(',').map((word) => `${word}:5`) : [] const output: ('text' | 'vtt' | 'srt')[] = ['text', 'srt', 'vtt'] @@ -88,11 +87,11 @@ export default function Index() { if (error) throw new Error(error.value.description) const { text, srt, vtt } = data - status.value = 'done' + setStatus('done') return { raw: text, srt, vtt, videoSource } } catch (error) { toast.error(`Something went wrong. Reason: ${error instanceof Error ? error.message : 'Unknown.'}`) - status.value = 'idle' + setStatus('idle') return initialState } } @@ -102,7 +101,7 @@ export default function Index() { return (
- {status.value === 'idle' && ( + {status === 'idle' && ( <>

Upload media

@@ -157,10 +156,8 @@ export default function Index() {
)} - {status.value !== 'idle' && status.value !== 'done' && ( - - )} - {status.value === 'done' && ( + {status !== 'idle' && status !== 'done' && } + {status === 'done' && ( =14'} - '@preact/signals-core@1.8.0': - resolution: {integrity: sha512-OBvUsRZqNmjzCZXWLxkZfhcgT+Fk8DDcT/8vD6a1xhDemodyy87UJRJfASMuSD8FaAIeGgGm85ydXhm7lr4fyA==} - - '@preact/signals-react@2.2.0': - resolution: {integrity: sha512-EPYlhXqqcOUxz2gTQGt4rtK6X7Jr04517DcJVZ4I5a7Gxy39haK24uFeVWtiU/tnEReRFcxpQN6poYra1jf68A==} - peerDependencies: - react: ^16.14.0 || 17.x || 18.x - '@prisma/client@5.22.0': resolution: {integrity: sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==} engines: {node: '>=16.13'} @@ -9710,14 +9699,6 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@preact/signals-core@1.8.0': {} - - '@preact/signals-react@2.2.0(react@19.0.0-rc.1)': - dependencies: - '@preact/signals-core': 1.8.0 - react: 19.0.0-rc.1 - use-sync-external-store: 1.2.2(react@19.0.0-rc.1) - '@prisma/client@5.22.0(prisma@5.22.0)': optionalDependencies: prisma: 5.22.0 diff --git a/zerops.yml b/zerops.yml index b45e4f50..4e467479 100644 --- a/zerops.yml +++ b/zerops.yml @@ -19,14 +19,14 @@ zerops: - echo "Upgrading bun to 1.1.38" - bun upgrade buildCommands: - - pnpm install + - pnpm install --frozen-lockfile --prefer-offline --prod=false - bun run postinstall - bun run validateEnv - - bun x nx build:executable backend --verbose --skip-nx-cache - - ls apps/backend + - pnpm nx build:executable backend --verbose --skip-nx-cache + - ls node_modules/prisma deployFiles: - apps/backend/dist - - node_modules/.prisma + - node_modules cache: - node_modules - package.json @@ -47,7 +47,7 @@ zerops: - echo "Installing yt-dlp" - curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/bin/yt-dlp - chmod a+rx /usr/bin/yt-dlp # Make executable - start: apps/backend/dist/main + start: PRISMA_QUERY_ENGINE_LIBRARY=./node_modules/prisma; apps/backend/dist/main deploy: readinessCheck: