forge42dev / Remix-Forge

VS Code extension that allows you to generate configurable Remix code
MIT License
78 stars 6 forks source link

Dropped routes with "convert routes" #10

Open jfsiii opened 10 months ago

jfsiii commented 10 months ago

What I did

I ran "Convert routes to v2 convention" from on a directory that looked like this

tree routes before: 19 directories, 47 files ``` routes/ ├── __anonymous │   ├── change-password.tsx │   ├── forgot-password.tsx │   ├── login.tsx │   ├── logout.tsx │   └── webhooks.ld-update.tsx ├── __anonymous.health.tsx ├── __anonymous.tsx ├── index.tsx ├── participant │   ├── sessions │   │   ├── $courseId │   │   │   └── assessments │   │   │   ├── $evaluationId │   │   │   │   ├── index.tsx │   │   │   │   └── result.tsx │   │   │   ├── index.tsx │   │   │   └── new.tsx │   │   ├── $courseId.tsx │   │   └── index.tsx │   └── sessions.tsx ├── sessions │   ├── $courseId │   │   ├── assessments │   │   │   ├── $assessmentType.$assessmentId │   │   │   │   ├── $evaluationTemplateId │   │   │   │   │   ├── evaluate.$participantId.tsx │   │   │   │   │   ├── index.tsx │   │   │   │   │   └── response-breakdown.tsx │   │   │   │   ├── index.tsx │   │   │   │   └── response-breakdown.tsx │   │   │   ├── $assessmentType.$assessmentId.tsx │   │   │   ├── $evaluationId.tsx │   │   │   ├── components │   │   │   │   └── AssessmentList.tsx │   │   │   ├── index.tsx │   │   │   └── types.ts │   │   ├── facilitators │   │   │   └── update.tsx │   │   ├── participants │   │   │   ├── index.tsx │   │   │   ├── results.$participantId.tsx │   │   │   ├── signin-info │   │   │   │   ├── index.tsx │   │   │   │   └── pdf.tsx │   │   │   └── update.tsx │   │   ├── participants.tsx │   │   └── summary │   │   └── index.tsx │   ├── $courseId.tsx │   ├── components.tsx │   ├── create.tsx │   └── index.tsx └── users ├── $userId.change-password.tsx ├── $userId.edit.tsx ├── bulk-import │   ├── csv.ts │   ├── facility.tsx │   ├── index.tsx │   ├── upload.tsx │   └── validation-preview.tsx ├── bulk-import.tsx ├── create.tsx └── index.tsx 19 directories, 47 files ```
npx remix routes before ``` ```

What I observed

It said it succeeded but it lost a lot of files

Screenshot 2023-08-09 at 11 22 09 AM
tree routes after: 1 directory, 19 files ``` routes/ ├── _anonymous..login.md ├── _anonymous.change-password.tsx ├── _anonymous.forgot-password.tsx ├── _anonymous.health.tsx ├── _anonymous.login.tsx ├── _anonymous.logout.tsx ├── _anonymous.tsx ├── _anonymous.webhooks.ld-update.tsx ├── _index.tsx ├── participant.sessions.tsx ├── sessions.$courseId.tsx ├── sessions._index.tsx ├── sessions.components.tsx ├── sessions.create.tsx ├── users.$userId.change-password.tsx ├── users.$userId.edit.tsx ├── users._index.tsx ├── users.bulk-import.tsx └── users.create.tsx 1 directory, 19 files ```
npx remix routes after ``` ```

It's not clear to me what the issue is, but hopefully the before/after routes will help. Let me know if I can do any thing to give more data or context.

AlemTuzlak commented 10 months ago

@jfsiii Thank you for the report! I've been trying to figure this one out because it was reported to me but had no luck due to lack of info. This is greatly appreciated. Will try to replicate with this to find the root cause.

AlemTuzlak commented 7 months ago

@jfsiii there have been some improvements to the underlying code, could you try this again if it works? I have a feeling it is due to an OS difference because when I test it on windows it works.

jfsiii commented 6 months ago

@AlemTuzlak Still no luck.

Here's some info about the before/initial routes

remix-routes-main.txt tree-routes-main.txt

And here's what I saw running in VS Code

Screenshot 2023-12-18 at 7 50 43 PM

Here's the routes after conversion

remix-routes-forge.txt tree-routes-forge.txt

The diff of the last line from the two tree outuput

- 21 directories, 53 files
+ 1 directory, 22 files

I'm not sure of the process for conversion but it's losing alot of routes. All (?) the routes in users/bulk-import/* for example.

In getting the screenshots for this response, I started fresh and ran it in VS Code again. This time I got only the "Flattening route to v2 convention finished!" success message but the results were still the same on disk.

We do have some non-route files in there (a components subdirectory in one, two? types.ts files)

ignoredFilePatterns from remix.config.js ``` // ignore all files in routes folder to prevent // default remix convention from picking up routes ignoredRouteFiles: ['**/*'], routes(defineRoutes) { // uses the v1 convention, works in v1.15+ and v2 return createRoutesFromFolders( defineRoutes, // optionally add the real ignored route files here as needed { ignoredFilePatterns: [ // ignore (do not make accessible in UI) any files under `routes/` which: // start with a `.` '**/.*', // are named types.ts, types.tsx, components.ts, etc '**/{components,utils,types}.ts{,x}', // are in a routes/**/components, routes/**/utils, or routes/**/types directory '**/{components,utils,types}/*', ], } ); ```

but there's only a few of them, and none a directory like users/bulk-import which is getting lost

└── users
    ├── $userId.change-password.tsx
    ├── $userId.edit.tsx
    ├── bulk-import
    │   ├── csv.ts
    │   ├── facility.tsx
    │   ├── index.tsx
    │   ├── upload.tsx
    │   └── validation-preview.tsx
    ├── bulk-import.tsx
    ├── create.tsx
    └── index.tsx