kiliman / remix-flat-routes

Remix package to define routes using the flat-routes convention
MIT License
695 stars 24 forks source link

Routes starting with underscore (_) are not converted to escaped underscore ([_]) #32

Closed milamer closed 11 months ago

milamer commented 1 year ago

Hey hey,

I have found a bug when converting my project to the flat routes format.

Issue Summary

When running npx migrate-flat-routes <sourceDir> <targetDir> [options], routes starting with an underscore _ are not converted correctly. They should be converted to an escaped underscore [_] but are instead converted to to a normal underscore _. Only routes starting with two underscores __ should be converted to a regular underscore _

Steps to Reproduce

  1. Create a directory with at least one route file that starts with an underscore (e.g. _route.js)
  2. Run npx migrate-flat-routes <sourceDir> <targetDir> [options] on the directory
  3. Observe that the resulting file in the target directory is named _route.js rather than [_]route.js

Expected Result

Routes starting with an underscore should be converted to [_] in the target directory.

Actual Result

Routes starting with an underscore are not converted correctly and are instead converted to _.

Additional Information

Thank you for your time and help in advance!

kiliman commented 1 year ago

True. I will fix the migrate command.