[PR #329] fix: improve deploy auth UX #481

Open
opened 2026-05-06 13:08:19 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/329
Author: @southpolesteve
Created: 3/7/2026
Status: 🔄 Open

Base: mainHead: codex/wrangler-auth-ux


📝 Commits (2)

  • aee4122 fix deploy auth UX
  • 0a88579 docs: clarify deploy-time cloudflare plugin behavior

📊 Changes

5 files changed (+561 additions, -62 deletions)

View changed files

📝 AGENTS.md (+4 -0)
📝 README.md (+14 -15)
📝 packages/vinext/src/cloudflare/tpr.ts (+62 -14)
📝 packages/vinext/src/deploy.ts (+277 -33)
📝 tests/deploy.test.ts (+204 -0)

📄 Description

Fixes #312

Summary

  • auto-detect interactive vs headless Wrangler auth during vinext deploy
  • reuse saved local auth or start wrangler login, and fail early in CI with exact token/account guidance
  • resolve CLOUDFLARE_ACCOUNT_ID from env or Wrangler config, including selected --env blocks
  • keep deploy host-neutral by injecting the Cloudflare Vite plugin at deploy time while preserving the warning from #315 as a softer note
  • document the local/CI flows and add regression coverage for auth/account-ID planning
  • add an AGENTS rule to refresh origin/main before starting work

Behavior By Scenario

  • vinext deploy stays Cloudflare-specific; Nitro remains the multi-platform path.
  • If wrangler is missing, vinext deploy installs it automatically.
  • In a local interactive terminal, vinext reuses an existing Wrangler session.
  • In a local interactive terminal without saved auth, vinext runs wrangler login and then continues.
  • In a headless shell without CLOUDFLARE_API_TOKEN, vinext fails early with a message that points to Wrangler login docs for local use and Cloudflare token docs for CI use.
  • In a headless shell with CLOUDFLARE_API_TOKEN but no account ID, vinext fails early before build.
  • Account ID can come from CLOUDFLARE_ACCOUNT_ID, top-level account_id, or env-specific account_id in the selected Wrangler env block.
  • If an existing vite.config.* is missing @cloudflare/vite-plugin, vinext warns but still injects the plugin for the deploy build so the deploy can proceed.
  • vinext init remains host-neutral; Cloudflare-specific behavior stays in vinext deploy.

Testing

  • npx vitest run tests/deploy.test.ts tests/init.test.ts
  • pnpm run typecheck

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/329 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 3/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/wrangler-auth-ux` --- ### 📝 Commits (2) - [`aee4122`](https://github.com/cloudflare/vinext/commit/aee41227ec37b700ddeb08dc1130c4af6edb51e7) fix deploy auth UX - [`0a88579`](https://github.com/cloudflare/vinext/commit/0a885798135fa5b9a5a673faabddae12c4cce9cf) docs: clarify deploy-time cloudflare plugin behavior ### 📊 Changes **5 files changed** (+561 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+4 -0) 📝 `README.md` (+14 -15) 📝 `packages/vinext/src/cloudflare/tpr.ts` (+62 -14) 📝 `packages/vinext/src/deploy.ts` (+277 -33) 📝 `tests/deploy.test.ts` (+204 -0) </details> ### 📄 Description Fixes #312 ## Summary - auto-detect interactive vs headless Wrangler auth during `vinext deploy` - reuse saved local auth or start `wrangler login`, and fail early in CI with exact token/account guidance - resolve `CLOUDFLARE_ACCOUNT_ID` from env or Wrangler config, including selected `--env` blocks - keep deploy host-neutral by injecting the Cloudflare Vite plugin at deploy time while preserving the warning from #315 as a softer note - document the local/CI flows and add regression coverage for auth/account-ID planning - add an AGENTS rule to refresh `origin/main` before starting work ## Behavior By Scenario - `vinext deploy` stays Cloudflare-specific; Nitro remains the multi-platform path. - If `wrangler` is missing, `vinext deploy` installs it automatically. - In a local interactive terminal, vinext reuses an existing Wrangler session. - In a local interactive terminal without saved auth, vinext runs `wrangler login` and then continues. - In a headless shell without `CLOUDFLARE_API_TOKEN`, vinext fails early with a message that points to Wrangler login docs for local use and Cloudflare token docs for CI use. - In a headless shell with `CLOUDFLARE_API_TOKEN` but no account ID, vinext fails early before build. - Account ID can come from `CLOUDFLARE_ACCOUNT_ID`, top-level `account_id`, or env-specific `account_id` in the selected Wrangler env block. - If an existing `vite.config.*` is missing `@cloudflare/vite-plugin`, vinext warns but still injects the plugin for the deploy build so the deploy can proceed. - `vinext init` remains host-neutral; Cloudflare-specific behavior stays in `vinext deploy`. ## Testing - `npx vitest run tests/deploy.test.ts tests/init.test.ts` - `pnpm run typecheck` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#481
No description provided.