create-expo-stack
create-expo-stack copied to clipboard
[cli] add option to run setup-ci after project is created
Description
This PR is a proposition of how create-expo-stack could integrate with setup-ci. It adds a prompt asking the user whether they want to bootstrap CI using setup-ci after the project is created and runs setup-ci in a subprocess at the end if the answer was "Yes".
Some details:
- we don't add the
setup-cioption to config, therefore the prompt appears after the user is asked whether they want to save their configuration, - the prompt only appears if
noInstall == false,noGit == falseandpackageManagerisyarnornpm, these are requirements forsetup-cito work in the generated project, - if the user decides to run
setup-ci, an env variable is setprocess.env.RUN_SETUP_CI = 'true', which is later read to decide whether the script should be run - this way we don't add new fields tocliResults, which would in turn alter the project configuration interface.
Demo
https://github.com/user-attachments/assets/5e8a1084-0fd4-4a3c-9cbd-6a0076bb3d9e
How Has This Been Tested?
- create-expo-stack version:
2.11.24 - setup-ci version:
0.6.0 - OS:
macOS Sonoma 14.7
Verified that npx setup-ci finishes execution successfully and generates all CI workflows when run on projects created with create-expo-stack using following configurations.
npx create-expo-stack@latest project1 --nativewindui
npx create-expo-stack@latest project2 --react-navigation --tabs --restyle --supabase --eas
npx create-expo-stack@latest project3 --stylesheet --firebase --yarn
npx create-expo-stack@latest project4 --expo-router --unistyles --supabase --yarn --eas
this is on my radar will get to it soon.
Initial thoughts are that I think we can ditch the env var and just let it be an extra prompt like the others
For right now we should just worry about getting it into the cli. We are actively considering other approaches to reduce the number of prompts, but that should be a separate concern.
I realise we were the ones to bring up that concern so sorry if thats confusing 😅
thanks for your initial thoughts!
There is a prompt, but the env variable is there to move the information whether setup-ci should be run (whether the answer to the prompt was "Yes") from runCLI.ts to printOutput.ts - this is an alternative to the general approach in CES which seems to be to store such info in CliResults. The problem with that is that it extends the cliResults type which I believe automatically extends the interface of the config that users can save and reuse?
I wanted to avoid getting setup-ci in the config, that's why the setup-ci prompt is after the "Would you like to save this configuration for future use?" prompt. Unless you think it's fine to extend this interface?
oh ok interesting, didn't realise that. I will have to check again to see what you mean about the interface
i'm going to dig into this this week