Skip to content

[autoconfig] Set up React Router projects in their own folder - #17324

Open
edmundhung wants to merge 2 commits into
mainfrom
autoconfig-react-router-project-path
Open

edmundhung wants to merge 2 commits into
mainfrom
autoconfig-react-router-project-path

Conversation

@edmundhung

@edmundhung edmundhung commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Part of RM-31810.

React Router's setup wrote workers/app.ts and app/entry.server.tsx, and installed isbot, relative to the current directory instead of the project's folder. So cf migrate apps/site/wrangler.jsonc from a repo root (cloudflare/cf#817) created workers/ and a package.json at the root and then failed. Setup now writes and installs into the project's folder. It also works with an existing workers/ folder, and keeps an existing workers/app.ts as it does app/entry.server.tsx.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: the Cloudflare docs don't cover autoconfig's internals, and this is a fix

Devin Review

@changeset-bot

changeset-bot Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dfcd9d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/autoconfig Patch

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

devin-ai-integration[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

React Router's setup wrote workers/app.ts and app/entry.server.tsx, and installed isbot, relative to the current directory, so a project outside it was set up in the wrong folder.
@edmundhung
edmundhung force-pushed the autoconfig-react-router-project-path branch from cf21fe8 to a1b522b Compare December 1, 2026 23:00
@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@17324

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@17324

@cloudflare/cli-shared-helpers

npm i https://pkg.pr.new/@cloudflare/cli-shared-helpers@17324

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@17324

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@17324

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@17324

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@17324

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@17324

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@17324

miniflare

npm i https://pkg.pr.new/miniflare@17324

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@17324

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@17324

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@17324

@cloudflare/test-server

npm i https://pkg.pr.new/@cloudflare/test-server@17324

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@17324

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@17324

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@17324

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@17324

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@17324

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@17324

wrangler

npm i https://pkg.pr.new/wrangler@17324

commit: dfcd9d0

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

@edmundhung
edmundhung marked this pull request as ready for review December 1, 2026 23:17
@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team December 1, 2026 23:18
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/react-router-setup-project-folder.md: [@cloudflare/wrangler]
  • packages/autoconfig/src/frameworks/react-router.ts: [@cloudflare/wrangler]
  • packages/autoconfig/tests/frameworks/react-router.test.ts: [@cloudflare/wrangler]

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of dfcd9d07.

This review, of 9e5f0037

✅ Approved — No issues found. All file writes, the workers/ folder creation and the isbot install now resolve against projectPath, and the new tests cover each case. The patch changeset is correctly classified.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No security concerns in this change.


📋 Code Quality: ✅ LGTM

  • The Worker entry, app/entry.server.tsx and the workers folder are all joined onto projectPath, so nothing is written relative to the current directory. A test checks that no workers folder is created at the root.
  • The isbot install passes cwd: projectPath, the same way other frameworks pass cwd.
  • mkdirSync(..., { recursive: true }) works when a workers/ folder already exists.
  • writeAppTs keeps an existing workers/app.ts and warns, the same way writeEntryServerTsx keeps an existing app/entry.server.tsx.
  • The changeset is classified as a patch, which fits a bug fix.

📝 Documentation: ✅ LGTM

The changeset describes the change in terms users will see and has no type prefix.


Reviewed commit: 9e5f0037

…outer

Setup now creates workers/ only if it's missing and keeps an existing workers/app.ts, the project's own Worker entry.
@edmundhung
edmundhung force-pushed the autoconfig-react-router-project-path branch from 9e5f003 to dfcd9d0 Compare December 1, 2026 23:21

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Approved with comments — No defects found. There is one optional suggestion: log a warning when an existing workers/app.ts is kept, as setup already does for app/entry.server.tsx.

Findings: 1 suggestion (1 is an inline comment 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 #17324.

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

## SUGGESTION (1)

### [Code Quality] An existing `workers/app.ts` is kept without a warning, unlike `app/entry.server.tsx`.
- **File:** packages/autoconfig/src/frameworks/react-router.ts:307

📋 Code Quality: 💬 1 suggestion

Paths resolve correctly against projectPath; one optional suggestion about a missing warning.

Recommendation: 💬 Optional Nits

  • [SUGGESTION] An existing workers/app.ts is kept without a warning, unlike app/entry.server.tsx. (packages/autoconfig/src/frameworks/react-router.ts:307)
View full review
  • Every write in setup is joined onto projectPath: workers/app.ts, app/entry.server.tsx and the workers/ folder.
  • mkdirSync(..., { recursive: true }) works when a workers/ folder already exists.
  • The isbot install passes cwd: projectPath.
  • When workers/app.ts already exists, writeAppTs returns without logging anything. writeEntryServerTsx warns in the same case, so logging a warning here too would be more consistent.

✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns. The paths are fixed literals joined onto the project root.


📝 Documentation: ✅ LGTM

The changeset describes the change in terms users will see, has no type prefix, and is correctly classified as a patch.


Reviewed commit: dfcd9d07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants