Change error wording and list conflicting files when initializing app#2785
Merged
Timer merged 3 commits intofacebook:masterfrom Jul 14, 2017
Merged
Change error wording and list conflicting files when initializing app#2785Timer merged 3 commits intofacebook:masterfrom
Timer merged 3 commits intofacebook:masterfrom
Conversation
Timer
suggested changes
Jul 13, 2017
| ]; | ||
| return fs.readdirSync(root).every(file => validFiles.indexOf(file) >= 0); | ||
| console.log(); | ||
| let conflicts = fs.readdirSync(root).map((file, index) => { |
Contributor
There was a problem hiding this comment.
This could be accomplished more succinctly with a filter:
const conflicts = fs.readdirSync(root).filter(file => !validFiles.includes(file));| } | ||
| }); | ||
|
|
||
| if (conflicts.length > 0) { |
Contributor
There was a problem hiding this comment.
How about we invert this for less nesting?
if (conflicts.length < 1) {
return true;
}| )} already exists and contains files that could cause conflicts:` | ||
| ); | ||
| console.log(); | ||
| console.log(JSON.stringify(conflicts, null, ' ')); |
Contributor
There was a problem hiding this comment.
I'm not a fan of JSON output; can we list them instead?
for (const file of conflicts) {
console.log(` ${file}`);
}| console.log( | ||
| `The directory ${chalk.green( | ||
| name | ||
| )} already exists and contains files that could cause conflicts:` |
Contributor
There was a problem hiding this comment.
I feel like "already exists" is redundant, the original message should be fine:
`The directory ${chalk.green(name)} contains files that could conflict.`
Contributor
Author
|
Cool, updated the requested changes 😃 |
Contributor
|
Fantastic! Could you please upload a new picture? |
Timer
approved these changes
Jul 14, 2017
Contributor
Author
Contributor
|
Beautiful, thank you so much! I switched the period to a colon after conflict. |
Contributor
|
Hi there! This change is out in |
JohnNilsson
referenced
this pull request
in JohnNilsson/create-react-app-typescript
Aug 9, 2017
* change error wording and list conflicting files when initializing app * update code * Update createReactApp.js
morgs32
pushed a commit
to BrickworkSoftware/create-react-app
that referenced
this pull request
Sep 1, 2017
* change error wording and list conflicting files when initializing app * update code * Update createReactApp.js
JohnNilsson
referenced
this pull request
in JohnNilsson/create-react-app-typescript
Sep 9, 2017
* change error wording and list conflicting files when initializing app * update code * Update createReactApp.js
kasperpeulen
pushed a commit
to kasperpeulen/create-react-app
that referenced
this pull request
Sep 24, 2017
* change error wording and list conflicting files when initializing app * update code * Update createReactApp.js
swengorschewski
referenced
this pull request
in swengorschewski/cra-typescript-electron
Oct 16, 2017
* change error wording and list conflicting files when initializing app * update code * Update createReactApp.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR for #2780:
Tested by running

create-react-appwith and without folder containing possible conflicting files: