A command to list routes for an application that uses react router.
- List routes. (Currently this works via cypress + a react app running.) ✅
- Should allow static evaluation and not require the app to be running. ✅
- a top level typescript config enables interaction with jsx elements
- the following command is used to run the implementations file with typescript
npx tsx src/implementations.ts
V1, react-routes worked but required both an app and cypress implementation to run.
V2, react-routes is working and is a full cli solution with no server needing to run. 🎉
use the command: npx tsx src/implementations.ts
to see v2 in action!
I need to find or create react-router implementations that:
- show deeply nested route "object style" working.
- show deeply nested route "component style" working.
Ideally these will be in the react-router examples codebase or be added when/if this change is pr'd. ✅ This was achieved due to the update script in package.json that grabs the example folder from react-router.
Therefore, I am going to start using some of the react-router examples as my initial data-set.
(list generated by looking at a few lines and then using count lines of code to find the largest examples.)
- route-objects examples/route-objects/src/App.tsx
- auth examples/auth-router-provider/src/App.tsx
- transitions examples/view-transitions/src/main.tsx
This project will have a test folder that uses cypress to assert the routes output match desired results. COMING SOON, currently exists in implementations file.
Resources:
https://github.com/AlDanial/cloc
cd ../react-router/examples/ &&
for d in ./*/ ; do (
cd "$d" &&
printf '%-40s' "$d" &&
cloc --vcs git |
grep -vE "Language|JSON|-|TypeScript|CSS|HTML|Markdown|github.com/AlDanial|JSX|JavaScript"
); done &&
cd -;