sebovzeoueb
sebovzeoueb
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
in fact it doesn't even need the raw HTML, it'll just let me do a normal script tag
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
in theory I can make a client javascript directory and build that to a single file and then only do the awful raw HTML to include that script
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
so I can actually get pretty close to my original goal here I think
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
yup
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
bamboozled by the red lines
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
VSCode pretends it won't work but it does
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
well I be damned, you can actually also add .js files like I did with the .css
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
No description
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
VSCode is not happy about me importing that style.css but it is actually working and including it in the bundle
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
so, this actually works:
import { Hono } from 'hono'
import { html } from 'hono/html'
import { $ } from 'bun'
import style from "./style.css" with { type: "file" }
import { file } from "bun"

const app = new Hono()

app.get('/', (c) => {
return c.html(
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<h1>Hello Server Side</h1>
{html`<button onClick="fetch('/install', {method: 'POST'})">
Install Hello World
</button>`}
</body>
</html>)
})
app.get('/style.css', c => file(style).text().then(text => c.text(text)))
app.post('/install', async c => {
try {
await $`docker compose up -d`
return c.json({success: true})
}
catch {
return c.json({success: false})
}
})

export default app
import { Hono } from 'hono'
import { html } from 'hono/html'
import { $ } from 'bun'
import style from "./style.css" with { type: "file" }
import { file } from "bun"

const app = new Hono()

app.get('/', (c) => {
return c.html(
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<h1>Hello Server Side</h1>
{html`<button onClick="fetch('/install', {method: 'POST'})">
Install Hello World
</button>`}
</body>
</html>)
})
app.get('/style.css', c => file(style).text().then(text => c.text(text)))
app.post('/install', async c => {
try {
await $`docker compose up -d`
return c.json({success: true})
}
catch {
return c.json({success: false})
}
})

export default app
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
I was looking at HonoX too, but the build process for that also outputs some .js files that need to be loaded by the client
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
I'm not a super fan of this but it does work
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
app.get('/', (c) => {
return c.html(
<html>
<h1>Hello Server Side</h1>
{html`<button onClick="fetch('/install', {method: 'POST'})">
Install Hello World
</button>`}
</html>)
})
app.get('/', (c) => {
return c.html(
<html>
<h1>Hello Server Side</h1>
{html`<button onClick="fetch('/install', {method: 'POST'})">
Install Hello World
</button>`}
</html>)
})
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
best workaround so far is using the raw html feature in hono JSX
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
one of the quite annoying issues that I haven't yet figured out a good fix for is that there doesn't seem to be a way to include any client side JavaScript in the executable because bun thinks all .js files are supposed to be part of the exe
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
it was my first port of call
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
the bun devs have confirmed that to me already
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
the html import feature doesn't work with the executable feature yet unfortunately
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
but I realize that would be confusing to people who want to build an actual web server
118 replies
HHono
Created by sebovzeoueb on 1/20/2025 in #help
Is there a simple way to bundle the directory served by serveStatic into a single file executable?
well I meant more that I thought maybe the bun builder would do it automatically so that when the serveStatic route tries to read a file, it loads it from the bundled ones instead of the actual filesystem
118 replies