Repository navigation
[autoconfig] Set up Hono projects for cf with Vite - #17246
Conversation
🦋 Changeset detectedLatest commit: 6e14cd5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I'm Bonk, and I've done a quick review of your PR. PR #17246 adds
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/cli-shared-helpers
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/test-server
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
0049733 to
14de0f7
Compare
There was a problem hiding this comment.
Superseded by the review of
c57cc6c3.
This review, of 14de0f72
💬 Approved with comments — No blocking or warning-level issues. One INFO note remains open about a leftover Hono dev-server adapter import, which the author has deferred.
Findings: 1 info
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info
One INFO note remains open about a leftover adapter import. Nothing new blocks.
Recommendation: 💬 Optional Nits
- [INFO] The
@hono/vite-dev-server/cloudflareadapter import can be left behind, unused, afterdevServer(...)is replaced. The author deferred this. (packages/autoconfig/src/frameworks/hono.ts:139)
View full review
Leftover adapter import. readHonoVitePlugins only collects default imports whose source is exactly @hono/vite-dev-server or @hono/vite-build. Some configs also have import adapter from "@hono/vite-dev-server/cloudflare" and pass it to devServer({ adapter }). In those configs, the adapter import stays in the file, unused, after devServer(...) is removed. The author has deferred this, since dropping an import safely means checking its other uses, so it is kept as INFO.
The new supported: boolean type, JSX parsing for .jsx and .tsx, and the dropped generic <pm> run build command are consistent with every caller.
✅ All other checks passed
🚀 Release: ✅ LGTM
The changeset records the new Hono setup as a minor feature and says which projects it supports. The setup installs Vite and the Cloudflare plugin and rewrites the project's Vite configuration. These changes happen in the user's own project, where they can be reviewed and undone.
🔒 Security: ✅ LGTM
No security issues found.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md issues found.
⚡ Performance: ✅ LGTM
No performance issues found.
📝 Documentation: ✅ LGTM
No documentation issues found.
Reviewed commit: 14de0f72
jamesopstad
left a comment
There was a problem hiding this comment.
Approving with a couple of comments.
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
There was a problem hiding this comment.
Superseded by the review of
6e14cd55.
This review, of c57cc6c3
✅ Approved — The two follow-up changes, leaving Vite's install to setup and passing target for CommonJS packages, are correct and have tests, and nothing new came up. The one earlier note still open, a leftover adapter import, was deferred by the author.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The changeset follows the repository's convention of a minor version for new features. The setup only changes files in the user's own project, where those changes can be reviewed and undone.
🔒 Security: ✅ LGTM
The Vite config and entry files are only parsed statically. They are never run, and nothing is written outside the user's project.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md issues found.
📋 Code Quality: ✅ LGTM
Hono no longer installs Vite itself; setup's own install now handles it. It also passes target to transformViteConfig, and a test covers a package with no "type". I found no new issues.
One earlier note is still open and not repeated here: the leftover @hono/vite-dev-server/cloudflare adapter import, which you have deferred.
⚡ Performance: ✅ LGTM
This is one-off setup code with single parses; nothing in it runs on a hot path.
📝 Documentation: ✅ LGTM
No documentation issues found.
Reviewed commit: c57cc6c3
Setup already installs Vite before configuring a framework, and skips it on purpose when Vite comes from the workspace or a hoisted install, so Hono no longer installs its own. Hono now passes the target when it changes an existing Vite config, so a package that isn't ESM gets a plugin import that Vite can load.
c57cc6c to
6e14cd5
Compare
There was a problem hiding this comment.
✅ Approved — The supported flag change since the last review is handled correctly by every caller, and nothing new came up. The one earlier note still open was deferred by the author.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The changeset records a minor release for the new Hono setup, which matches how the repository releases new features. The setup only changes files in the user's own project, where those changes can be reviewed and undone.
🔒 Security: ✅ LGTM
Setup only parses the Vite config and entry files statically. It never runs them, and it writes nothing outside the user's project.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md issues found.
📋 Code Quality: ✅ LGTM
FrameworkInfo.supported is now a boolean, and Hono sets it to target === "cf". Every place that reads it handles a value only known at runtime:
frameworks/index.tscheckssupported === falseand picksNoOpFrameworkfor Hono on Wrangler.isFrameworkSupportedreturns the flag as is.supported !== trueandsupported === trueinframeworks/index.tsanddetails/index.tswork as expected.
One earlier note is still open: the leftover @hono/vite-dev-server/cloudflare adapter import, which you deferred.
⚡ Performance: ✅ LGTM
This is one-off setup code; nothing in it runs on a hot path.
📝 Documentation: ✅ LGTM
No documentation issues found.
Reviewed commit: 6e14cd55
Part of RM-31810. Stacked on #17238.
On cf, autoconfig now sets up Hono projects instead of refusing them, building them with Vite and the Cloudflare plugin like Hono's Workers + Vite starter. It adds Vite to a plain Hono app, replaces Hono's own Vite dev server and build plugins, and uses the app's entry file (the Wrangler
main, theentrygiven to Hono's Vite plugins, orsrc/index.ts(x)) as the Worker entry point. An entry file that doesn't export the app, such as Hono's Node.js starter, is refused, and so is HonoX for now. The Wrangler target is unchanged.Along the way, cf stops treating
@netlify/build-info's generic<package manager> run buildas a framework's own build command, and the shared parser accepts JSX in.tsxfiles.