Repository navigation
[autoconfig] Set up React Router projects in their own folder - #17324
edmundhung wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: dfcd9d0 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 |
|
LGTM |
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.
cf21fe8 to
a1b522b
Compare
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/cli-shared-helpers
@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/test-server
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
There was a problem hiding this comment.
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.tsxand theworkersfolder are all joined ontoprojectPath, so nothing is written relative to the current directory. A test checks that noworkersfolder is created at the root. - The
isbotinstall passescwd: projectPath, the same way other frameworks passcwd. mkdirSync(..., { recursive: true })works when aworkers/folder already exists.writeAppTskeeps an existingworkers/app.tsand warns, the same waywriteEntryServerTsxkeeps an existingapp/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.
9e5f003 to
dfcd9d0
Compare
There was a problem hiding this comment.
💬 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.tsis kept without a warning, unlikeapp/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.tsxand theworkers/folder. mkdirSync(..., { recursive: true })works when aworkers/folder already exists.- The
isbotinstall passescwd: projectPath. - When
workers/app.tsalready exists,writeAppTsreturns without logging anything.writeEntryServerTsxwarns 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
Part of RM-31810.
React Router's setup wrote
workers/app.tsandapp/entry.server.tsx, and installedisbot, relative to the current directory instead of the project's folder. Socf migrate apps/site/wrangler.jsoncfrom a repo root (cloudflare/cf#817) createdworkers/and apackage.jsonat the root and then failed. Setup now writes and installs into the project's folder. It also works with an existingworkers/folder, and keeps an existingworkers/app.tsas it doesapp/entry.server.tsx.