Fixes #305#344
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| bodyContent = bodyContent.replace(/<br>/g, "<br />"); | ||
| bodyContent = bodyContent.replace(/<hr([^>]*[^\/])?>/g, "<hr$1 />"); | ||
| // remove unescaped script tags from body | ||
| bodyContent = bodyContent.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*[^>]*>/gi, ""); |
| if (!htmlResponse.ok) throw new Error(`HTML fetch failed: ${htmlResponse.statusText}`); | ||
| const htmlCode = await htmlResponse.text(); | ||
| const htmlPath = path.join(outDir, `${targetScreen.id}.html`); | ||
| await fs.writeFile(htmlPath, htmlCode); |
| if (!imageResponse.ok) throw new Error(`Image fetch failed: ${imageResponse.statusText}`); | ||
| const imageBuffer = await imageResponse.arrayBuffer(); | ||
| const imagePath = path.join(outDir, `${targetScreen.id}.jpeg`); | ||
| await fs.writeFile(imagePath, Buffer.from(imageBuffer)); |
| } | ||
| } | ||
|
|
||
| await writeFile(join(safeOutDir, "tailwind.config.ts"), tailwindConfigCode); |
| bodyContent = bodyContent.replace(/<script/gi, "<div").replace(/<\/script/gi, "</div"); | ||
|
|
||
| const pageCode = `export default function Page() {\n return (\n <>\n${bodyContent}\n </>\n );\n}\n`; | ||
| await writeFile(join(safeOutDir, "app", "page.tsx"), pageCode); |
|
|
||
|
|
||
| const layoutCode = `import './globals.css';\n\nexport const metadata = {\n title: 'Stitch Next.js App',\n description: 'Generated by @google/stitch-sdk',\n};\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang="en">\n <head>\n ${fontLinks}\n </head>\n <body>\n {children}\n </body>\n </html>\n );\n}\n`; | ||
| await writeFile(join(safeOutDir, "app", "layout.tsx"), layoutCode); |
Fixes #305
Fixes #319
Fixes #320
Fixes #322
Fixes #323
Fixes #324
Fixes #325
Fixes #326
Fixes #327
Fixes #328
Fixes #329
Fixes #330
Fixes #331
label: fleet-merge-ready
milestone: 1
PR created automatically by Jules for task 5860293050553752988 started by @davideast