Alt description missing in image
Beta: Plugins coming soon!
Alt description missing in image

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

ArgumentTypeQuestion / Description
workspacePathautocompleteWhere would you like to add this route?
=> e.g. features/@app-core
screenNametextWhat should the screen component be called?
=> string
routePathtextWhat url do you want this route on?
=> e.g. /some/path
initialDataTargetautocompleteWould 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`