
add-route
npm run add:route -- --args <workspacePath> <screenName> <routePath> <initialDataTarget>
npx turbo gen route --args <workspacePath> <screenName> <routePath> <initialDataTarget>
- 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`