Patch Changes
-
#16369
ec0bea4Thanks @MattieTK! - Stop autoconfig in non-interactive runs when a project root holds both static files and a PagesfunctionsdirectoryWhen a project without a detected framework has a
functionsdirectory, autoconfig asks whether it is a Cloudflare Pages project. Non-interactive runs (CI and coding agents) assume it is not and continue as a static site. When the static files are in the project root, that deploys the root as static assets, and the Pages Functions (the project's API routes) are not deployed.In that case autoconfig now stops with an error explaining that Pages Functions cannot be migrated automatically yet. For Pages Functions it suggests moving the static files into a subdirectory and deploying with
wrangler pages deploy, or migrating the Functions to a Worker; for afunctionsdirectory that is not Pages Functions, it suggests moving the static files into a subdirectory or adding a configuration file. Projects whose static files are already in a subdirectory, projects detected as Pages or with a detected framework, and interactive runs where the user answers the prompt are unaffected. -
#16367
b4653b4Thanks @MattieTK! - Write a protective.assetsignorewhen autoconfig uses the project root as the static assets directoryAutoconfig is meant to write an
.assetsignorewhen the project root itself is the assets directory, so that local files are not uploaded as public assets. The check compared the detected output directory, which is relative ("."), with the absolute project path, so it never matched and no.assetsignorewas written. A static project with anindex.htmlat its root (for example afterwrangler setupor a zero-configwrangler deploy) then uploaded files such as.env,.dev.vars,.gitandnode_modulesas public assets.The check now resolves the assets directory that the generated configuration uses and compares it with the project root, so frameworks that set their own build output directory (such as Nuxt or SvelteKit) do not get an unused root
.assetsignore. The generated.assetsignorealso covers what a Cloudflare Pages upload skips, alongside the existing.wrangler,.dev.vars*and.env*entries:/_worker.js,/_routes.jsonand/functionsat the root (so nested paths such asblog/functions/index.htmlare still uploaded),node_modules,.gitand.DS_Storeat any depth, and.npmrc. If an existing.assetsignoreonly lists a narrower pattern such as.env,.env*is added so that files like.env.productionare skipped too. When the project root of an assets-only project contains a Pagesfunctionsdirectory or_worker.js, autoconfig now warns that it will not be deployed, since it is excluded from the assets and not run as server code. -
Updated dependencies [
b4653b4,8b64bec]:- @cloudflare/cli-shared-helpers@0.3.0
- @cloudflare/workers-utils@0.50.1
- @cloudflare/config@0.29.0