Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to initialize create-react-app in existing github repo

I'm sometimes using create-react-app inside an existing repo that contains some other stuff (or it's just a repo that someone else created and gave me access to). The workflow for that seems a bit weird, especially due to the create-react-app naming restrictions

git clone [email protected]:MY-ORG/MY-REPO.git
cd MYREPO
npx create-react-app my-app
cp my-app/* ./
rm -rf my-app

that seems to be a bit a strange flow and I'm wondering how other people do this more elegantly.

like image 966
SCBuergel Avatar asked Nov 30 '25 01:11

SCBuergel


1 Answers

I can't say for certain this will work with all situations, but I find myself needing to create a GitHub repo first for any project. Then I clone it, and change into that directory.

But instead of running CRA with my-app, I simply run it with a . plus my templates.

The steps looks something like this:

git clone [email protected]:MY-ORG/MY-REPO.git
cd MY-REPO
npx create-react-app . --template typescript
like image 114
tim.rohrer Avatar answered Dec 01 '25 14:12

tim.rohrer