Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] add option to run setup-ci after project is created #425

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

km1chno
Copy link

@km1chno km1chno commented Oct 30, 2024

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-ci option 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 == false and packageManager is yarn or npm, these are requirements for setup-ci to work in the generated project,
  • if the user decides to run setup-ci, an env variable is set process.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 to cliResults, which would in turn alter the project configuration interface.

Demo

setup-ci-in-ces-demo.mov

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

@km1chno km1chno changed the title add option to run setup-ci after project is created [cli] add option to run setup-ci after project is created Oct 30, 2024
@dannyhw
Copy link
Collaborator

dannyhw commented Oct 30, 2024

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 😅

@km1chno
Copy link
Author

km1chno commented Nov 4, 2024

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?

@dannyhw
Copy link
Collaborator

dannyhw commented Nov 4, 2024

oh ok interesting, didn't realise that. I will have to check again to see what you mean about the interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants