sjc5 / hwy

Hwy is a fullstack web framework for driving a (p)react frontend with a Go backend. Includes end-to-end typesafety, file-based nested UI routing, and much more.
BSD 3-Clause "New" or "Revised" License
320 stars 3 forks source link

v0.6.0 – Idiomorph #42

Closed sjc5 closed 1 year ago

sjc5 commented 1 year ago

v0.6.0 – Idiomorph

Overview

This release:

Upgrade instructions

To upgrade your existing Hwy app to use idiomorph, do the following:

Step 1

npm i hwy@0.6.0
npm i -D @hwy-js/build@0.6.0 @hwy-js/client@0.6.0 @hwy-js/dev@0.6.0 idiomorph

Why is idiomorph a dev dependency? Because it's bundled into your client entry at build time (no need for idiomorph to live next to Hono/Hwy on your server other than as part of your static assets).

Step 2

Then, add { idiomorph: true } to your getDefaultBodyProps call (which returns the props you spread into your app's root body tag). For example:

<body {...getDefaultBodyProps({ idiomorph: true })}>

Or, if you're using NProgress, you can do this:

<body {...getDefaultBodyProps({ idiomorph: true, nProgress: true })}>

Step 3

Then, update your client.entry.{ts,js} file to the following:

import { initHtmx, initIdiomorph } from "@hwy-js/client";

initHtmx().then(initIdiomorph);

Or, if you're using NProgress, you can do this:

import { initHtmx, initIdiomorph, initNProgress } from "@hwy-js/client";

initHtmx().then(initIdiomorph).then(initNProgress);

New app instructions

Just run:

npx create-hwy@latest

Idiomorph will be included by default for new apps created with create-hwy.

Bonus

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hwy-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2023 10:45pm