facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.69k stars 26.84k forks source link

Not able to run create-react-app in an django app #3135

Closed jbovenschen closed 6 years ago

jbovenschen commented 7 years ago

I want to start a discussion about how create-react-app validates if something is a suitable folder to put it's files in.

I did create a custom script which makes it possible to use create-react-app within our django environment.

Currently this functions checks if the folder can be used to put the template in the given folder name. https://github.com/facebookincubator/create-react-app/blob/master/packages/create-react-app/createReactApp.js#L573-L609

This says it is only if one of the following files only exists in the directory; .DS_Store, Thumbs.db, .git, .gitignore, .idea, README.md, LICENSE, web.iml, .hg, .hgignore, .hgcheck,

This means it can't be put in a directory started with bootstrap functions used in other frameworks and or languages.

My idea is to change this behaviour to something which checks for the files who don't need to exists like a package.json etc... and then copy to folder to a unique name in the parent dir, bootstrap the create-react-app directory after that is done copy back all the files, if this fails remove the folder created by creat-react-app and give an error about it.

gaearon commented 6 years ago

Create it in a separate folder. That's the intended way to use it.