thoughtbot / belt

Belt is a CLI for starting a new React Native Expo app and will even keep your pants secure as you continue development.
MIT License
131 stars 3 forks source link

Install Expo with preferred package manager #21

Closed stevehanson closed 11 months ago

stevehanson commented 1 year ago

Motivation: Expo supports starting a new app with npm, pnpm, yarn, and bun. Our CLI should respect those options as well.

Additional motivation: bun is around 5-10x faster (I haven't actually measured but it's quite significant) than npm for the initial app creation. The feedback cycle when developing this library is a lot faster if we can test the CLI using bun.

Details

Detects the package manager that was used to start thoughtbelt. So, if for example, we created a new app by running bunx thoughtbelt MyApp, thoughtbelt now detects that it's running in a Bun environment and executes bunx create-expo. Since the Expo CLI has similar logic, it creates the new app using Bun (i.e. runs bun install, which creates a bun lockfile). The same logic also applies to running yarn create expo, npx create-expo, and pnpm create expo.

Additionally, this PR also adds flags to specify the package manager to use for the new app, so we can for example run npx thoughtbelt@latest MyApp --bun, and it will create the Expo app with Bun. I think this will be less used, and we might even want to remove prior to v1.