Repository navigation
[autoconfig] Look for a static site only on cf - #17297
edmundhung wants to merge 4 commits into
Conversation
On Wrangler, frameworks keep their own setup, so detection no longer reads their settings for a static site. A framework that refuses settings it can't read safely then refuses only on cf.
|
|
LGTM |
@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
|
There was a problem hiding this comment.
Superseded by the review of
89b47ddf.
This review, of abcfba52
💬 Approved with comments — The guard is correct and nothing that reads staticSite breaks on Wrangler. The only note is optional: two of the three new guards have no test.
Findings: 1 info (1 is an inline comment on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📋 Code Quality: 💬 1 info
The change is correct and consistent with its callers. Two of the three new guards have no test.
Recommendation: 💬 Optional Nits
- [INFO] No test checks the Vite native-fallback guard or the
confirmAutoConfigDetailsguard fortarget: "wrangler". (packages/autoconfig/src/details/index.ts:282)
View full review
On Wrangler, everything that reads staticSite still works:
run.tsalready branches ontarget.outputDirstill falls back to the framework'sdistand tofindAssetsDirwhenstaticSiteis undefined.- The JSDoc changes in
framework-class.tsandtypes.tsmatch the new behaviour.
The new test only covers the first guard. The Vite native-fallback guard and the guard in confirmAutoConfigDetails are not checked for the Wrangler target.
✅ All other checks passed
🔒 Security: ✅ LGTM
No security concerns in this change.
📝 Documentation: ✅ LGTM
The updated JSDoc matches the new behaviour.
Reviewed commit: abcfba52
| framework = getFrameworkClassInstance("vite", target); | ||
| staticSite = framework.findStaticSite(projectPath); | ||
| staticSite = | ||
| target === "cf" ? framework.findStaticSite(projectPath) : undefined; |
There was a problem hiding this comment.
ℹ️ INFO · Code Quality
No test checks the Vite native-fallback guard or the confirmAutoConfigDetails guard for target: "wrangler".
The new test only covers the first guard, at line 237, and only for a project that resolves to the static framework. This guard in the Vite native-fallback branch and the one in confirmAutoConfigDetails (around line 656) have no test for the Wrangler target. A small assertion that findStaticSite is not called, or that staticSite stays undefined, on those paths would catch a regression if someone drops one of the guards.
…ramework picker on Wrangler The Vite fallback only runs on cf, so its check never applied. Changing the framework on Wrangler now has a test that findStaticSite isn't called.
There was a problem hiding this comment.
✅ Approved — No issues found: the cf-only checks are correct, and the earlier note about missing tests has been covered by the new Wrangler tests.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
The change narrows when the code reads framework settings for a static site. It adds or loosens no checks and no input handling.
📋 Code Quality: ✅ LGTM
- Vite fallback:
canInspectViteProjectreturns false whentarget !== "cf", so the fallback only runs on cf and needs no check of its own. confirmAutoConfigDetails: the new Wrangler test assertsfindStaticSiteis not called.getDetailsForAutoConfig: the Hugo test asserts the same fortarget: "wrangler", and that the cf result includesstaticSite.- JSDoc: the updates in
framework-class.tsandtypes.tsmatch the new behaviour.
📝 Documentation: ✅ LGTM
The updated JSDoc matches the new cf-only behaviour.
Reviewed commit: 89b47ddf
|
Closing as #17288 resolves it in a different way already. |
Part of cloudflare/cf#804.
The hook
findStaticSitewas introduced in #17280. It was never designed and planned to be used by Wrangler but it runs regardless of the target. This simply restrict it to cf only so any logic added tofindStaticSitewont impact wrangler. No changeset as the hook isn't released yet and is merged only a couple hours ago.