[wrangler][C3] Use qwik add cloudflare-workers instead of cloudflare-pages#12569
[wrangler][C3] Use qwik add cloudflare-workers instead of cloudflare-pages#12569
Conversation
🦋 Changeset detectedLatest commit: 83d89ef The changes in this PR will be included in the next version bump. 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 |
|
Claude finished @MattieTK's task —— View job Changeset Review✅ All changesets look good The changeset file
The changeset properly covers both affected packages and provides good context about why the change was necessary. |
| async function addAssetsIgnoreFile(projectPath: string) { | ||
| const toAdd = ["_worker.js", "_routes.json", "_headers", "_redirects"]; | ||
|
|
||
| await writeFile( |
There was a problem hiding this comment.
assets ignore gets added by the qwik adapter already
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Looks good to me, thanks @MattieTK 🙂
petebacondarwin
left a comment
There was a problem hiding this comment.
Note that the qwik C3 tests are all quarantined right now, so they are not being tested in CI!
yeah you're right... 😓 it's also difficult to check wether these changes are valid given the fact that the quick CLI currently produces borken apps 😓 |
…Workers targets Switch both the wrangler autoconfig and C3 Workers template for Qwik from 'qwik add cloudflare-pages' to 'qwik add cloudflare-workers'. The cloudflare-workers adapter generates the correct Workers-specific scaffolding (adapters/cloudflare-workers/, .assetsignore, wrangler.jsonc with main + assets fields), removing the need for post-hoc cleanup of Pages-specific files. Also adds --skipConfirmation=true to all qwik add invocations so the interactive prompt is skipped in automated contexts.
2788057 to
83d89ef
Compare
Fixes https://jira.cfdata.org/browse/DEVX-2443
Use the correct Qwik adapter (
cloudflare-workers) when targeting Workers, instead of running the Pages adapter and cleaning up after it.Both the wrangler autoconfig (
packages/wrangler/src/autoconfig/frameworks/qwik.ts) and the C3 Workers template (packages/create-cloudflare/templates/qwik/workers/c3.ts) were runningqwik add cloudflare-pageseven when targeting Cloudflare Workers. This caused the wrong adapter directory structure to be scaffolded (adapters/cloudflare-pages/instead ofadapters/cloudflare-workers/), and required post-hoc cleanup of Pages-specific files like_routes.jsonand manual creation of.assetsignore.Qwik provides a dedicated
cloudflare-workersadapter (qwik add cloudflare-workers) that generates the correct Workers configuration out of the box:adapters/cloudflare-workers/vite.config.ts(correct adapter directory)wrangler.jsoncwithmainandassetsfieldspublic/.assetsignorewith the correct entriespackage.jsonscriptsChanges
packages/wrangler/src/autoconfig/frameworks/qwik.ts:qwik add cloudflare-pages→qwik add cloudflare-workers--skipConfirmation=trueto skip Qwik's interactive promptaddAssetsIgnoreFile()function (the adapter now generates this)writeFileimportconfigurationDescriptionstringpackages/create-cloudflare/templates/qwik/workers/c3.ts:qwik add cloudflare-pages→qwik add cloudflare-workers--skipConfirmation=trueremoveFile("./public/_routes.json")(the workers adapter doesn't generate this)removeFileimportpackages/create-cloudflare/templates/qwik/pages/c3.ts:--skipConfirmation=truefor consistency