Generating a new screen when using Expo Router results in wrong placement
Describe the bug
Reproduce:
npx ignite-cli new PizzaApp2025b \
--bundle=com.pizzaapp2025b \
--git \
--install-deps \
--target-path=/Users/jh/Code/Temp/PizzaApp2025b \
--remove-demo=false \
--new-arch \
--experimental=expo-router \
--workflow=cng \
--no-timeout=false \
--state=mst
(Keep the demo code in, use expo router.)
npx ignite-cli@latest g screen About
It adds it to ./app/screens. Should be in ./src/app/screens, I believe.
Ignite version
10.1.6 (latest)
Additional info
no
You really want to specify via --dir cli switch, there is no way to determine where you want your route in the file-based routing system, unless you just want it to be one huge single stack. It really isn't intended to use defaults.
It's in the generation docs: https://docs.infinite.red/ignite-cli/concept/Generators/#--dir
I guess you can still fix the template to be a destinationDir of src/app instead when making the screen template, but won't buy you much once you graduate to more nested URLs
https://github.com/infinitered/ignite/blob/master/src/tools/react-native.ts#L230-L267
@frankcalise thinking this through, we can't assume the location, but prompting them to input their desired path and then defaulting to src/app. It's rather lightweight and doesn't require a lot on them but if they're familiar with their structure it still helpful.
@cdanwards yeah that's interesting.
so something like this might work
IF
destinationDir isn't set in the template, like how the current template works for non expo router
AND
--dir is not provided for expo-router variation
THEN
prompt (enter could even accept a default if we felt like detecting app or src/app exists)
Relevant comment on the other PR: https://github.com/infinitered/ignite/pull/2905#issuecomment-2842973512
Closed by #2905