add-route
npm run add:routeInteractive, or with args (positional or named; --args optional):
npm run add:route -- --args <workspacePath> <screenName> <routePath> <initialDataTarget>npm run add:route -- features/@app-core PostScreen /posts "[slug]" healthCheck
npm run add:route -- --workspacePath features/@app-core --screenName PostScreen --routePath /posts "[slug]"- add-route.ts
Prompt Arguments
| Argument | Type | Question / Description |
|---|---|---|
| workspacePath | autocomplete | Where would you like to add this route? => e.g. features/@app-core |
| screenName | text | What should the screen component be called? => string |
| routePath | text | What url do you want this route on? => e.g. /some/path |
| initialDataTarget | autocomplete | Would you like to fetch initial data from a resolver? => string |
Resulting File Changes
/apps/expo/
└── app/(generated)/{routePath}/index.tsx ❇️ # <- e.g. '/posts/[slug]/' (expo-router)
/apps/next/
└── app/(generated)/{routePath}/page.tsx ❇️ # <- e.g. '/posts/[slug]/' (Next.js app router)
/{workspacePath}/ # <- e.g. 'features/@app-core/' or 'packages/some-package/'
└── screens/
└── {ScreenName}.tsx ❇️
└── routes/
└── {routePath}/ ❇️ # <- e.g. '/posts/[slug]/'
└── index.tsx ❇️ # -> re-exported to `@app/next` and `@app/expo`