Skip to content

Change error wording and list conflicting files when initializing app#2785

Merged
Timer merged 3 commits into
react:masterfrom
OwenFlood:master
Jul 14, 2017
Merged

Change error wording and list conflicting files when initializing app#2785
Timer merged 3 commits into
react:masterfrom
OwenFlood:master

Conversation

@OwenFlood

Copy link
Copy Markdown
Contributor

PR for #2780:

Tested by running create-react-app with and without folder containing possible conflicting files:
screen shot 2017-07-13 at 2 36 08 pm

];
return fs.readdirSync(root).every(file => validFiles.indexOf(file) >= 0);
console.log();
let conflicts = fs.readdirSync(root).map((file, index) => {

@Timer Timer Jul 13, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be accomplished more succinctly with a filter:

const conflicts = fs.readdirSync(root).filter(file => !validFiles.includes(file));

}
});

if (conflicts.length > 0) {

@Timer Timer Jul 13, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, ' '));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like "already exists" is redundant, the original message should be fine:

`The directory ${chalk.green(name)} contains files that could conflict.`

@OwenFlood

Copy link
Copy Markdown
Contributor Author

Cool, updated the requested changes 😃

@Timer

Timer commented Jul 14, 2017

Copy link
Copy Markdown
Contributor

Fantastic! Could you please upload a new picture?

@Timer Timer added this to the 1.0.11 milestone Jul 14, 2017
@OwenFlood

Copy link
Copy Markdown
Contributor Author

New screenshot:
screen shot 2017-07-13 at 6 29 13 pm

@Timer

Timer commented Jul 14, 2017

Copy link
Copy Markdown
Contributor

Beautiful, thank you so much! I switched the period to a colon after conflict.

@Timer

Timer commented Aug 9, 2017

Copy link
Copy Markdown
Contributor

Hi there! This change is out in react-scripts@1.0.11; please give it a go! Thanks.

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
@lock lock Bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants