-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
ignore intellij module files when generating an app #4605
Conversation
Hmm, I think I'd rather allow regex valid files to be used than adding a special case like in this PR. This will make it more flexible for the future. What do you think? |
Yeah, that would work as well. I was just not sure if there's a reason for not having regexp in valid files except historical one. Let me add regexp support there |
On a second thought, existing paths will require conversion and will look a little bit ugly. Or we can go with glob patterns. As far as I see glob is already in node_modules, just not explicitly mentioned |
Hi @gaearon, I'd still love to get this fixed and merged if you don't have any objections. In order to improve it would be nice to get some feedback on mine questions. |
@@ -663,6 +662,8 @@ function isSafeToCreateProjectIn(root, name) { | |||
const conflicts = fs | |||
.readdirSync(root) | |||
.filter(file => !validFiles.includes(file)) | |||
// IJ creates module files before CRA is launched | |||
.filter(file => file.indexOf('.iml') < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use regex here for consistency with how we do it elsewhere:
.filter(file => file.indexOf('.iml') < 0) | |
.filter(file => !/\.iml$/.test(file)) |
@@ -663,6 +662,8 @@ function isSafeToCreateProjectIn(root, name) { | |||
const conflicts = fs | |||
.readdirSync(root) | |||
.filter(file => !validFiles.includes(file)) | |||
// IJ creates module files before CRA is launched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's spell this out for users that don't know what IntelliJ is.
// IJ creates module files before CRA is launched | |
// IntelliJ IDEA creates module files before CRA is launched |
b5d040e
to
c058ca9
Compare
Rebased & added requested changes |
Thanks! |
Thank you! |
* facebook-master: (578 commits) Add PR welcoming badge (facebook#5759) Suggest Encore when not building a SPA with Symfony (facebook#5730) Merge webpack configuration (facebook#5722) Tweak bot settings Update stale.yml Fix typo (facebook#5727) Version bump postcss-preset-env to latest (facebook#5721) Updated the link to firebase hosting (facebook#5710) Fixed link to manifest.json file (facebook#5704) Fix broken documentation link (facebook#5670) Fix tsconfig.json lib suggested value (facebook#5701) Add permissive TS lib defaults (facebook#5694) Lock issues more aggressively Make stale bot configuration more aggressive ignore intellij module files when generating an app (facebook#4605) update envinfo to 5.11.1 (facebook#5685) Add bot config (facebook#4483) Publish Update cached lock file Add changelog for 2.1.1 ...
When IntelliJ IDEA generates a project, it creates a module file (*.iml) in the root directory of the project by default. IDEA does that before it launches project generator process which is causing CRA to abort due to these extra files.
We used to workaround that via generating the project in a temporary directory, but that causes another set of problems, such as:
WEB-29489 (aka #200)
WEB-33257
and additionally is just slower due to copying the generated project to the proper location.
It would be better to ignore *.iml files in the generator script.
These changes were checked by generating the project from the terminal and from IntelliJ (with temp dir workaround disabled).