Repository navigation
[autoconfig] Run the Astro beta's astro add without installing the Astro beta for cf - #16995
Conversation
🦋 Changeset detectedLatest commit: 56a0b89 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. Runs Astro beta’s
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@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/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
a2f816c to
6d66047
Compare
03eb143 to
e7ad67d
Compare
e7ad67d to
be8e1df
Compare
Yarn Classic's missing `dlx` affects every autoconfig caller of `packageManager.dlx`, so it needs a shared fix rather than a special case here.
|
Codeowners approval required for this PR:
Show detailed file reviewers |
There was a problem hiding this comment.
💬 Approved with comments — The approach is sound. One WARNING remains: projects detected as Yarn Classic (v1) now go through yarn dlx, which Yarn Classic does not have. The author has chosen to fix that in the shared package manager definition instead.
Findings: 1 warning · 1 info (2 are inline comments on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
🔧 Fix with your agent
Paste the following into your coding agent to investigate and fix these issues.
Fix the following code review issues found in pull request #16995.
Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
## WARNING (1)
### [Code Quality] Yarn Classic (v1) projects now run `yarn dlx astro@beta add …`, but Yarn Classic has no `dlx`, so the cf Astro setup fails where `yarn astro add` used to work. Kept at WARNING despite @edmundhung [author]'s reply: the gap is shared with other `dlx` callers, but this pull request is what moves the Astro path onto `dlx`.
- **File:** packages/autoconfig/src/frameworks/astro.ts:108
## INFO (1)
### [Code Quality] The test covers only npm (single-segment `dlx`). The two-segment pnpm prefix this pull request fixes isn't exercised.
- **File:** packages/autoconfig/tests/frameworks/astro.test.ts:58
📋 Code Quality: ⚠️ 1 warning · 1 info
Running the beta's astro add through dlx fixes the pnpm version-resolution problem. Yarn Classic projects now hit yarn dlx, which they lack, and the test covers only npm.
Recommendation: 📝 Minor Comments
- [WARNING] Yarn Classic (v1) projects now run
yarn dlx astro@beta add …, but Yarn Classic has nodlx, so the cf Astro setup fails whereyarn astro addused to work. Kept at WARNING despite @edmundhung [author]'s reply: the gap is shared with otherdlxcallers, but this pull request is what moves the Astro path ontodlx. (packages/autoconfig/src/frameworks/astro.ts:108) - [INFO] The test covers only npm (single-segment
dlx). The two-segment pnpm prefix this pull request fixes isn't exercised. (packages/autoconfig/tests/frameworks/astro.test.ts:58)
View full review
Running the beta's astro add once through the package manager's dlx command fixes the pnpm problem: pnpm kept the locked stable Astro, so the stable astro add wrote wrangler.jsonc instead of cloudflare.config.ts. This change also keeps the project's Astro version.
Yarn Classic (astro.ts:108)
YarnPackageManager.dlxis["yarn", "dlx"](packages/workers-utils/src/package-manager.ts:42), and Yarn Classic has nodlxcommand.- Before this change, Yarn projects ran
yarn astro add …against the locally installedastro. That works on Yarn Classic. The new command,yarn dlx astro@beta add …, does not. - The author's point stands: the other
dlxcallers have the same gap, so the proper fix belongs in the shared Yarn definition. Still, this pull request is what moves the Astro cf path ontodlx. Until that shared fix lands, this is a behaviour change for Yarn Classic users, so the finding stays a WARNING. - Mentioning the limitation in the changeset, or landing the shared fix first, would cover it.
Tests
- The updated test asserts only the npm command, where
dlxis the single segment["npx"]. - Adding a pnpm case that asserts
["pnpm", "dlx", "astro@beta", "add", …]would exercise the two-segment prefix. That is the case this pull request fixes.
✅ All other checks passed
📝 Documentation: ✅ LGTM
The changeset accurately describes the problem and the fix.
Reviewed commit: 56a0b893
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Part of RM-31810.
For cf, autoconfig installed
astro@betato get theastro addthat writescloudflare.config.ts. pnpm kept the project's locked stable Astro, because 7.4.12 satisfies the saved^7.4.4-beta.0. So stable'sastro addwrotewrangler.jsoncinstead, andastro buildfailed in the Cloudflare adapter beta. Autoconfig now runs the beta'sastro addonce through the package manager'sdlxcommand and keeps the project's Astro version. The beta differs from stable 7.4.4 only inastro add.