mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 16:03:34 +00:00
Compare commits
1
Commits
iframeInjection
...
webpm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b22a19e6e |
No files matched your search
Generated
+1242
-63
File diff suppressed because it is too large.
Load diff
@@ -52,6 +52,8 @@
|
||||
"@tanstack/react-query": "^5.56.2",
|
||||
"@unhead/addons": "^2.0.10",
|
||||
"@unhead/react": "^2.0.10",
|
||||
"@webpm/store": "file:../webpm/packages/store",
|
||||
"@webpm/webpm": "file:../webpm/packages/webpm",
|
||||
"buffer": "^6.0.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -59,6 +61,7 @@
|
||||
"decimal.js": "^10.6.0",
|
||||
"embla-carousel-react": "^8.3.0",
|
||||
"esbuild-wasm": "^0.25.8",
|
||||
"fflate": "^0.8.2",
|
||||
"i18next": "^25.5.2",
|
||||
"ignore": "^7.0.5",
|
||||
"input-otp": "^1.2.4",
|
||||
@@ -86,10 +89,12 @@
|
||||
"tailwind-merge": "^2.5.2",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"tailwindcss-safe-area": "^0.8.0",
|
||||
"tar-stream": "^3.1.7",
|
||||
"turndown": "^7.2.1",
|
||||
"uri-templates": "^0.2.0",
|
||||
"use-stick-to-bottom": "^1.1.1",
|
||||
"vaul": "^0.9.3",
|
||||
"vite-plugin-node-polyfills": "^0.24.0",
|
||||
"webln": "^0.3.2",
|
||||
"zod": "^3.25.76"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { webpm, fileContentStore } from '@webpm/webpm';
|
||||
|
||||
// Import polyfills first
|
||||
import './lib/polyfills.ts';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useParams, useSearchParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { type Project } from '@/lib/ProjectsManager';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
@@ -19,16 +19,20 @@ import { StarButton } from '@/components/StarButton';
|
||||
import { useBuildProject } from '@/hooks/useBuildProject';
|
||||
import { useIsProjectPreviewable } from '@/hooks/useIsProjectPreviewable';
|
||||
import { useConsoleError } from '@/hooks/useConsoleError';
|
||||
import { webpm } from '@webpm/webpm';
|
||||
import { useFS } from '@/hooks/useFS';
|
||||
|
||||
export function ProjectView() {
|
||||
const { projectId } = useParams<{ projectId: string }>();
|
||||
const { t } = useTranslation();
|
||||
const { fs } = useFS();
|
||||
const [project, setProject] = useState<Project | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [activeTab, setActiveTab] = useState<'preview' | 'code'>('preview');
|
||||
const [mobileView, setMobileView] = useState<'chat' | 'preview' | 'code'>('chat');
|
||||
const [isAILoading, setIsAILoading] = useState(false);
|
||||
const [isProjectDetailsOpen, setIsProjectDetailsOpen] = useState(false);
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
// Use console error state from provider
|
||||
const { consoleError, dismissConsoleError, clearErrors } = useConsoleError();
|
||||
@@ -112,6 +116,24 @@ export function ProjectView() {
|
||||
navigate('/');
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (project && searchParams.get('build')) {
|
||||
const packageJson = await fs.readFile(`/projects/${project.id}/package.json`, 'utf8');
|
||||
await webpm.installWithUntarHandler(JSON.parse(packageJson), {
|
||||
onProgress: (e) => {
|
||||
console.log(`Build progress:`, e.currentProgress);
|
||||
},
|
||||
onComplete: () => {
|
||||
console.log('Build complete');
|
||||
},
|
||||
}, {
|
||||
includeDevDependencies: false,
|
||||
});
|
||||
}
|
||||
})();
|
||||
}, [fs, project, searchParams]);
|
||||
|
||||
if (!project && !isLoading) {
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex items-center justify-center">
|
||||
|
||||
@@ -2,6 +2,7 @@ import path from "node:path";
|
||||
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
import { defineConfig } from "vitest/config";
|
||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(() => ({
|
||||
@@ -10,6 +11,16 @@ export default defineConfig(() => ({
|
||||
port: 8080,
|
||||
},
|
||||
plugins: [
|
||||
nodePolyfills({
|
||||
include: ["buffer", "process", "stream", "module"],
|
||||
exclude: ["http", "https", "net", "tls", "child_process"],
|
||||
globals: {
|
||||
Buffer: true,
|
||||
global: true,
|
||||
process: true,
|
||||
},
|
||||
protocolImports: true,
|
||||
}),
|
||||
react(),
|
||||
],
|
||||
build: {
|
||||
@@ -52,4 +63,7 @@ export default defineConfig(() => ({
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ["tar-stream", "fflate"],
|
||||
},
|
||||
}));
|
||||
Reference in new issue
Block a user