bosia 0.6.17 → 0.6.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bosia",
3
- "version": "0.6.17",
3
+ "version": "0.6.18",
4
4
  "type": "module",
5
5
  "description": "A fast, batteries-included fullstack framework — SSR · Svelte 5 Runes · Bun · ElysiaJS. File-based routing inspired by SvelteKit. No Node.js, no Vite, no adapters.",
6
6
  "keywords": [
@@ -295,24 +295,32 @@ export async function prerenderStaticRoutes(manifest: RouteManifest): Promise<vo
295
295
  // ─── Static Site Output ──────────────────────────────────
296
296
 
297
297
  export function generateStaticSite(): void {
298
- if (!existsSync(`${OUT_DIR}/prerendered`)) {
299
- console.log("\n⏭️ No prerendered pages — skipping static site output");
298
+ const hasPublic = existsSync("./public");
299
+ const hasPrerender = existsSync(`${OUT_DIR}/prerendered`);
300
+
301
+ // Mirror `public/` → `dist/static/` on every build (not only SSG builds) so
302
+ // production containers can ship dist/ alone. Without this, apps with zero
303
+ // prerendered routes (pure SSR) would lose bosia-tw.css and favicons when
304
+ // public/ is dropped from the image.
305
+ if (!hasPublic && !hasPrerender) {
306
+ console.log("\n⏭️ No public/ or prerendered pages — skipping static site output");
300
307
  return;
301
308
  }
302
309
 
303
310
  console.log("\n📦 Generating static site...");
304
311
  mkdirSync(`${OUT_DIR}/static`, { recursive: true });
305
312
 
306
- // 1. HTML files from prerendering
307
- cpSync(`${OUT_DIR}/prerendered`, `${OUT_DIR}/static`, { recursive: true });
308
-
309
- // 2. Client JS/CSS — preserves /dist/client/... absolute paths used in HTML
310
- cpSync(`${OUT_DIR}/client`, `${OUT_DIR}/static/dist/client`, { recursive: true });
311
-
312
- // 3. Public assets (bosia-tw.css, favicon, etc.) — preserves /bosia-tw.css path
313
- if (existsSync("./public")) {
313
+ // 1. Public assets (bosia-tw.css, favicon, etc.) — preserves /bosia-tw.css path
314
+ if (hasPublic) {
314
315
  cpSync("./public", `${OUT_DIR}/static`, { recursive: true });
315
316
  }
316
317
 
318
+ // 2. HTML files from prerendering (SSG output only)
319
+ if (hasPrerender) {
320
+ cpSync(`${OUT_DIR}/prerendered`, `${OUT_DIR}/static`, { recursive: true });
321
+ // 3. Client JS/CSS — preserves /dist/client/... absolute paths used in HTML
322
+ cpSync(`${OUT_DIR}/client`, `${OUT_DIR}/static/dist/client`, { recursive: true });
323
+ }
324
+
317
325
  console.log(`✅ Static site generated: ${OUT_DIR}/static/`);
318
326
  }