From 239edf075f860a50d5293d96a1f65deb3a2f6215 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 9 Oct 2025 06:26:10 -0400 Subject: [PATCH] fix vite build (wip) --- .../app/src/pages/PageEnigma/PageEnigma.tsx | 4 ++++ frontend/apps/editor3d/package.json | 2 +- frontend/libs/api-enums/package.json | 10 ++++++++++ frontend/libs/api/package.json | 10 ++++++++++ .../components/create-3d-modal/package.json | 10 ++++++++++ .../libs/components/gallery-modal/package.json | 10 ++++++++++ .../libs/components/lightbox-modal/package.json | 10 ++++++++++ .../libs/components/login-modal/package.json | 10 ++++++++++ .../libs/components/login-modal/vite.config.ts | 8 +++++++- .../libs/components/model-selector/package.json | 10 ++++++++++ frontend/libs/components/promptbox/package.json | 10 ++++++++++ .../promptbox/src/lib/PromptBox2D.tsx | 3 +-- .../promptbox/src/lib/PromptBox3D.tsx | 5 +---- .../libs/components/tutorial-modal/package.json | 10 ++++++++++ frontend/libs/tauri-events/src/index.ts | 2 ++ .../useGenerationEnqueueSuccessEvent.ts | 8 ++++++++ frontend/libs/tauri-events/vite.config.ts | 8 +++++++- frontend/tsconfig.base.json | 17 ++++++++++++++++- frontend/tsconfig.json | 12 ++++++------ 19 files changed, 143 insertions(+), 16 deletions(-) diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/PageEnigma.tsx b/frontend/apps/editor3d/app/src/pages/PageEnigma/PageEnigma.tsx index 6f4595feb4..8c4751e766 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/PageEnigma.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/PageEnigma.tsx @@ -88,11 +88,15 @@ export const PageEnigma = ({ sceneToken }: { sceneToken?: string }) => { }); }); + console.log(">>> test - install events in PageEnigma"); + useGenerationEnqueueSuccessEvent(); useGenerationEnqueueFailureEvent(); useGenerationCompleteEvent(); useGenerationFailedEvent(); + console.log(">>> test - install events in PageEnigma block over"); + useFlashUserInputErrorEvent(async (event) => { console.log("Flash user input error event received:", event); toast.error(event.message); diff --git a/frontend/apps/editor3d/package.json b/frontend/apps/editor3d/package.json index 7b87344f5c..57fe94f492 100644 --- a/frontend/apps/editor3d/package.json +++ b/frontend/apps/editor3d/package.json @@ -17,7 +17,7 @@ "build": "vite build", "preview": "vite preview --port 8080", "dev": "echo 'editor3d' && vite dev", - "production-preview": "echo 'editor3d dev with production preview' && vite build && vite preview --port 5173", + "production-preview": "echo 'editor3d dev with production preview' && vite build --debug true --emptyOutDir --logLevel info && vite preview --port 5173", "staging-build": "vite build", "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint playground/* .", "typecheck": "tsc", diff --git a/frontend/libs/api-enums/package.json b/frontend/libs/api-enums/package.json index 3db0385334..b5ee06a6b2 100644 --- a/frontend/libs/api-enums/package.json +++ b/frontend/libs/api-enums/package.json @@ -3,6 +3,16 @@ "version": "0.0.1", "private": true, "type": "module", + "nx": { + "name": "@storyteller/api-enums", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/api/package.json b/frontend/libs/api/package.json index 5b33124531..a421ce47c5 100644 --- a/frontend/libs/api/package.json +++ b/frontend/libs/api/package.json @@ -3,6 +3,16 @@ "version": "0.0.1", "private": true, "type": "module", + "nx": { + "name": "@storyteller/api", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/create-3d-modal/package.json b/frontend/libs/components/create-3d-modal/package.json index 3c04d0e0c2..5de72ff939 100644 --- a/frontend/libs/components/create-3d-modal/package.json +++ b/frontend/libs/components/create-3d-modal/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-create-3d-modal", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-create-3d-modal", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/gallery-modal/package.json b/frontend/libs/components/gallery-modal/package.json index 6d2441ad84..5962126b63 100644 --- a/frontend/libs/components/gallery-modal/package.json +++ b/frontend/libs/components/gallery-modal/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-gallery-modal", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-gallery-modal", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/lightbox-modal/package.json b/frontend/libs/components/lightbox-modal/package.json index 9dda2f67db..3eb0b6de39 100644 --- a/frontend/libs/components/lightbox-modal/package.json +++ b/frontend/libs/components/lightbox-modal/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-lightbox-modal", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-lightbox-modal", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/login-modal/package.json b/frontend/libs/components/login-modal/package.json index ac61f52381..dcf8ec6db5 100644 --- a/frontend/libs/components/login-modal/package.json +++ b/frontend/libs/components/login-modal/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-login-modal", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-login-modal", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/login-modal/vite.config.ts b/frontend/libs/components/login-modal/vite.config.ts index 98ac28b77a..22771d6129 100644 --- a/frontend/libs/components/login-modal/vite.config.ts +++ b/frontend/libs/components/login-modal/vite.config.ts @@ -7,7 +7,13 @@ import * as path from 'path'; export default defineConfig(() => ({ root: __dirname, cacheDir: '../../../node_modules/.vite/libs/components/login-modal', - plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], + plugins: [ + react(), + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') + }) + ], // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], diff --git a/frontend/libs/components/model-selector/package.json b/frontend/libs/components/model-selector/package.json index 05a863f8ee..94058716ec 100644 --- a/frontend/libs/components/model-selector/package.json +++ b/frontend/libs/components/model-selector/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-model-selector", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-model-selector", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/promptbox/package.json b/frontend/libs/components/promptbox/package.json index 14f86e4787..c1dcccd4d7 100644 --- a/frontend/libs/components/promptbox/package.json +++ b/frontend/libs/components/promptbox/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-promptbox", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-promptbox", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx b/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx index 78d3f5e9de..00b6a3b591 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBox2D.tsx @@ -5,7 +5,6 @@ import { JobContextType, MaybeCanvasRenderBitmapType, UploaderState, - UploaderStates, } from "@storyteller/common"; import { PopoverMenu, PopoverItem } from "@storyteller/ui-popover"; import { Tooltip } from "@storyteller/ui-tooltip"; @@ -32,7 +31,7 @@ import { EnqueueContextualEditImage, EnqueueContextualEditImageSize, } from "@storyteller/tauri-api"; -import { usePrompt2DStore, RefImage } from "./promptStore"; +import { usePrompt2DStore } from "./promptStore"; import { gtagEvent } from "@storyteller/google-analytics"; import { getCapabilitiesForModel } from "@storyteller/model-list"; import { ImageModel } from "@storyteller/model-list"; diff --git a/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx b/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx index 5d04e5d25c..4e4edf00ba 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBox3D.tsx @@ -39,11 +39,8 @@ import { Signal } from "@preact/signals-react"; import { CommandSuccessStatus, EnqueueContextualEditImage, - EnqueueContextualEditImageModel, EnqueueContextualEditImageSize, - // waitForSoraLogin, } from "@storyteller/tauri-api"; -// import { showActionReminder } from "@storyteller/ui-action-reminder-modal"; import { usePrompt3DStore } from "./promptStore"; import { gtagEvent } from "@storyteller/google-analytics"; import { ImageModel } from "@storyteller/model-list"; @@ -98,7 +95,7 @@ export const PromptBox3D = ({ snapshotCurrentFrame, }: PromptBox3DProps) => { useSignals(); - const fileInputRef = useRef(null); + //const fileInputRef = useRef(null); const textareaRef = useRef(null); const [content, setContent] = useState(null); const [isModalOpen, setIsModalOpen] = useState(false); diff --git a/frontend/libs/components/tutorial-modal/package.json b/frontend/libs/components/tutorial-modal/package.json index ec9b6dca06..3fedb47192 100644 --- a/frontend/libs/components/tutorial-modal/package.json +++ b/frontend/libs/components/tutorial-modal/package.json @@ -2,6 +2,16 @@ "name": "@storyteller/ui-tutorial-modal", "version": "0.0.1", "type": "module", + "nx": { + "name": "@storyteller/ui-tutorial-modal", + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + } + } + }, "main": "./src/index.ts", "module": "./src/index.ts", "types": "./src/index.ts", diff --git a/frontend/libs/tauri-events/src/index.ts b/frontend/libs/tauri-events/src/index.ts index 170d20d67b..61b8b71f8f 100644 --- a/frontend/libs/tauri-events/src/index.ts +++ b/frontend/libs/tauri-events/src/index.ts @@ -12,3 +12,5 @@ export * from "./lib/events/generation/useGenerationEnqueueFailureEvent"; export * from "./lib/events/generation/useGenerationEnqueueSuccessEvent"; export * from "./lib/events/generation/useGenerationFailedEvent"; export * from "./lib/events/warning/FlashUserInputErrorEvent"; + +console.log(">>> test - tauri-events index.ts"); diff --git a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts index 8662f87d93..7dabd62b54 100644 --- a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts @@ -12,12 +12,19 @@ type GenerationEnqueueSuccessEvent = { model?: GenerationModel, }; +console.log(">>> test - useGenerationEnqueueSuccessEvent defined") + export const useGenerationEnqueueSuccessEvent = () => { + console.log(">>> test - useGenerationEnqueueSuccessEvent called") + useEffect(() => { + console.log(">>> test - useGenerationEnqueueSuccessEvent useEffect") + let isUnmounted = false; let unlisten: Promise; const setup = async () => { + console.log(">>> test - useGenerationEnqueueSuccessEvent setup") unlisten = listen>('generation-enqueue-success-event', async (event) => { console.log("Generation enqueue success event received:", event); const prefs = await GetAppPreferences(); @@ -38,6 +45,7 @@ export const useGenerationEnqueueSuccessEvent = () => { setup(); return () => { + console.log(">>> test - useGenerationEnqueueSuccessEvent unmount") isUnmounted = true; unlisten.then(f => f()); }; diff --git a/frontend/libs/tauri-events/vite.config.ts b/frontend/libs/tauri-events/vite.config.ts index 8d63ad899b..0bc770c4f0 100644 --- a/frontend/libs/tauri-events/vite.config.ts +++ b/frontend/libs/tauri-events/vite.config.ts @@ -7,7 +7,13 @@ import * as path from 'path'; export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/libs/tauri-events', - plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], + plugins: [ + react(), + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') + }) + ], // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], diff --git a/frontend/tsconfig.base.json b/frontend/tsconfig.base.json index 36b503f494..9bbae66278 100644 --- a/frontend/tsconfig.base.json +++ b/frontend/tsconfig.base.json @@ -28,7 +28,22 @@ // Uncomment if 2D ever gets used // "apps/editor2d/app/src/*", "apps/editor3d/app/src/*" - ] + ], + "@storyteller/api": ["libs/api/src/*"], + "@storyteller/api-enums": ["libs/api-enums/src/*"], + "@storyteller/tauri-api": ["libs/tauri-api/src/*"], + "@storyteller/tauri-events": ["libs/tauri-events/src/*"], + "@storyteller/tauri-utils": ["libs/tauri-utils/src/*"], + "@storyteller/ui-action-reminder-modal": ["libs/components/action-reminder-modal/src/*"], + "@storyteller/ui-button": ["libs/components/button/src/*"], + "@storyteller/ui-gallery-modal": ["libs/components/gallery-modal/src/*"], + "@storyteller/ui-modal": ["libs/components/modal/src/*"], + "@storyteller/ui-model-selector": ["libs/components/model-selector/src/*"], + "@storyteller/ui-pricing-modal": ["libs/components/pricing-modal/src/*"], + "@storyteller/ui-toaster": ["libs/components/ui-toaster/src/*"], + "@storyteller/ui-tutorial-modal": ["libs/components/tutorial-modal/src/*"], + + } } } diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 291c3c3411..7d757bc973 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -39,6 +39,12 @@ { "path": "./libs/components/tooltip" }, + { + "path": "./libs/tauri-api" + }, + { + "path": "./libs/tauri-events" + }, { "path": "./libs/tauri-utils" }, @@ -78,9 +84,6 @@ { "path": "./libs/common" }, - { - "path": "./libs/tauri-api" - }, { "path": "./libs/components/login-modal" }, @@ -150,9 +153,6 @@ { "path": "./libs/analytics/google-analytics" }, - { - "path": "./libs/tauri-events" - }, { "path": "./libs/components/provider-setup-modal" },