fix(cli): make the CLI work on Windows - #295
Merged
Merged
Conversation
|
Deploying astro with
|
| Latest commit: |
84a296c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9f1e2a2c.astro-e3t.pages.dev |
| Branch Preview URL: | https://fix-windows-cli.astro-e3t.pages.dev |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #294.
The full-matrix run behind that issue showed all 9 windows-latest CLI cells failing. Diagnosis against the actual job logs found only two fatal bugs (the other documented symptoms — the pnpm
.EXEbin warning, git init/add messages, and integration-install messages — all occur inside passing tests):1.
astro adddies under yarn on Windows (killed all 3 yarn cells)The CLI ran
astro add @qwik.dev/astrovia panam'spm.x(), which maps toyarn exec astro …for yarn — and yarn v1'sexecon Windows can't resolve locally installed bins (it only looks for the extension-less sh wrapper, neverastro.cmd). The failure then escalated to aprocess.exit(1)panic that killed the in-process test runner mid-suite.Fix: new
execLocalBin()helper routes yarn throughyarn run astro …(which resolves local.bincross-platform); every other package manager keeps the exactpm.x(npmSpec(...))path, denonpm:prefix included. Applied at all six call sites.Hardening in the same path: the panic message now surfaces the subprocess stderr/stdout (CI logs used to read literally
failed: .); the git commit call probesgit var GIT_COMMITTER_IDENTand supplies a fallback-cidentity only when git has none (bare CI runners), never overriding a configured user; and the git error branch no longer reports "failed to initialize" when it was adding changes.2. Two Windows path bugs in the test suite (failed all 6 npm/pnpm cells: "141 passed, 2 failed")
tests/jsx-strategy.spec.tsassertedinclude(outPath, "src/components/qwik")against backslash paths — now separator-normalized.tests/smoke-pack.spec.tshardcoded/tmp/...(drive-relative on Windows) andawait import(join(...))(invalid ESM specifier for Windows absolute paths) — nowjoin(tmpdir(), ...)andpathToFileURL(...).href, plus onestartsWith("/")→isAbsolute()sweep.No test was skipped, gated, or weakened.
Proof
This branch restores
windows-latestto the CLI matrix, so this PR's own CLI run executes all 27 cells. The combined local suite passes 143/143 on macOS under node, and the same suite already runs green on deno and bun cells on ubuntu/macos onbuild/v2.🤖 Generated with Claude Code