Skip to content

Beaufity output of eject.js script - #769

Merged
gaearon merged 18 commits into
react:masterfrom
azakordonets:master
Sep 30, 2016
Merged

Beaufity output of eject.js script#769
gaearon merged 18 commits into
react:masterfrom
azakordonets:master

Conversation

@azakordonets

Copy link
Copy Markdown
Contributor

Solution for issue ##750

Since in build.js we already use chalk library, i decided to reuse it in eject.js file. Operations are marked with green, file names and path's are marked with yellow and are underlined. Screenshots are attached .
screenshot 2016-09-26 20 53 54
screenshot 2016-09-26 20 54 03
screenshot 2016-09-26 20 54 11

@ghost

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@gaearon

Copy link
Copy Markdown
Contributor

I would prefer we keep the existing palette. We mostly use cyan and the default (no) color, can we do the same here? We also don’t use underlining everywhere else.


var ownPackageName = ownPackage.name;
console.log('Removing dependency: ' + ownPackageName);
console.log('Removing dependency: ' + yellowUnderline(ownPackageName));

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 think this should have the same indentation as “adding a dependency” but they both need to be grouped under “Updating package.json

return;
}
console.log('Adding dependency: ' + key);
console.log(green('\tAdding dependency: ') + yellowUnderline(key));

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.

Let’s use two-space indentation like in other commands.


files.forEach(function(file) {
console.log('Copying ' + file + ' to ' + appPath);
console.log(green('Copying ') + yellowUnderline(file) + ' to ' + yellowUnderline(appPath));

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.

Let’s indent these and group them under “Copying files...”

@azakordonets

azakordonets commented Sep 27, 2016

Copy link
Copy Markdown
ContributorAuthor

Done, done and done. Attaching screenshots to show how it looks right now.
screenshot 2016-09-27 08 39 33
screenshot 2016-09-27 08 37 26
screenshot 2016-09-27 08 37 34

@ghostghost added the CLA Signed label Sep 27, 2016
@ghost

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

var ownPackage = require(path.join(ownPath, 'package.json'));
var appPackage = require(path.join(appPath, 'package.json'));

console.log(cyan('Managing dependencies'));

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.

Let’s call this Updating dependencies...

fs.mkdirSync(path.join(appPath, 'scripts'));

console.log();
console.log(cyan('Copying files'));

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.

Let’s add ... at the end of every group title


console.log('Updating scripts');
console.log();
console.log(cyan('Updating scripts'));

@gaearongaearonSep 27, 2016

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.

Same here, let’s add ...


console.log('Writing package.json');
console.log();
console.log(cyan('Writing ') + 'package.json');

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.

And here

console.log(cyan('Managing dependencies'));
var ownPackageName = ownPackage.name;
console.log('Removing dependency: ' + ownPackageName);
console.log(red(' Removing dependency: ') + ownPackageName);

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.

Let’s use yellow here so it doesn’t feel like an error

@gaearongaearon added this to the 0.7.0 milestone Sep 27, 2016
@ghostghost added the CLA Signed label Sep 27, 2016
@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Done. Here's how it looks now :

screenshot 2016-09-27 18 00 00
screenshot 2016-09-27 18 00 09
screenshot 2016-09-27 18 00 16

console.log(cyan('Updating scripts...'));
delete appPackage.scripts['eject'];
Object.keys(appPackage.scripts).forEach(function (key) {
appPackage.scripts[key] = appPackage.scripts[key]

@gaearongaearonSep 27, 2016

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.

Let’s print each step here?
For example:

 Replacing "react-scripts start" with "node scripts/start.js"

console.log(cyan('Copying files...'));
files.forEach(function(file) {
console.log('Copying ' + file+ ' to ' + appPath);
console.log(cyan(' Copying ') + file+ ' to ' + appPath);

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.

Can you try making file and appPath cyan instead of Copying?

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.

Looking at the output, it prints the same giant appPath on every single line.

Suggestion: could we put this path in the header instead?

Copying files to /Users/.../tempApp ...
Copying .babelrc
Copying .eslintrc

return;
}
console.log('Adding dependency: ' + key);
console.log(cyan(' Adding dependency: ') + key);

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.

Similar, let’s make dependency name cyan (or yellow) instead of the label.

@gaearon

Copy link
Copy Markdown
Contributor

Sorry for the back-and-forth. Visual work takes some iterations. Can you try my suggestions?

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

No problem at all ! I'm very happy that i can contribute to the open source project that I'm using myself :) I've made adjustments you've mentioned and he's how it looks now :

screenshot 2016-09-28 11 47 34
screenshot 2016-09-28 11 47 43
screenshot 2016-09-28 11 47 50

@montogeek

Copy link
Copy Markdown
Contributor

Can we show Jest, Babel and ESLint output too?
Example:
Updating Jest config...

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Done. Added.

@montogeek

Copy link
Copy Markdown
Contributor

Thank you @azakordonets :)

new RegExp(ownPackageName + ' (\\w+)', 'g'),
'node scripts/$1.js'
);
console.log(' Replacing react-scripts ' + cyan(key) + ' with ' + cyan(appPackage.scripts[key]));

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.

Please make it so react-scripts is also cyan here. We're replacing a complete command.
Also let's put both "react-scripts start/test/build" and "node scripts/whatever.js" in quotes.

 Replacing "react-scripts start" with "node scripts/start.js"

@gaearon

Copy link
Copy Markdown
Contributor

This looks good to me. I left a comment about the last change I want to make.
Please also resolve the merge conflicts.

Thank you for working on this!

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Ok, i pushed this changed and it looks like this :

screen shot 2016-09-30 at 15 11 38

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

As for the merge conflicts, i don't have enough permissions to resolve conflicts.
screen shot 2016-09-30 at 15 12 30

@gaearon

Copy link
Copy Markdown
Contributor

To resolve conflicts:

git remote add facebookincubator https://github.com/facebookincubator/create-react-app.git
git fetch facebookincubator
git merge facebookincubator/master

You'll see the conflicts. After you resolve them, push the branch again.

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Done. You can check now. Since updating of .babelrc and .eslint files was taken out into separate commands, i also added console.log for them. Output looks like this now :
screen shot 2016-09-30 at 16 05 40

@gaearon

Copy link
Copy Markdown
Contributor

I like everything except the very last section.
Can we change it to be

Adding configuration to package.json...
Adding Babel preset
Adding ESLint configuration
Adding Jest configuration

I also think we can completely omit Writing package.json since it's not very descriptive.

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Would you like to have it all in cyan color, or should i only use cyan for "Adding" word ?

@gaearon

Copy link
Copy Markdown
Contributor

All cyan is fine.

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

What do you think about such formatting :
screen shot 2016-09-30 at 16 36 16
Or you would preffer to put it all Cyan ?

@gaearon

Copy link
Copy Markdown
Contributor

This looks good to me!

@gaearon

Copy link
Copy Markdown
Contributor

The only nit would be that ... after package.json shouldn't be white since it's not part of the filename

@gaearon

Copy link
Copy Markdown
Contributor

Also quotes in "node scripts/..." should be cyan, just like quotes in "react-scripts ...".

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Done. Looks like this :
screen shot 2016-09-30 at 18 54 55

@gaearon

Copy link
Copy Markdown
Contributor

This looks awesome. Thanks for sticking with it.
I’ll wait for Travis and merge!

@azakordonets

Copy link
Copy Markdown
ContributorAuthor

Sweeet :) My pleasure . I'm very new to Javascript and React, so it's really great that i managed to contribute to this cool project. I checked other issues with "Help wanted" label, but they don't seem easy for me to pick up for now, but i'll continue tracking this project. Thanks for oportunity

@gaearon
gaearon merged commit 27e76be into react:masterSep 30, 2016
@gaearongaearon mentioned this pull request Sep 30, 2016
kitze added a commit to kitze/custom-react-scripts that referenced this pull request Oct 3, 2016
…react-app
# By Dan Abramov (5) and others
# Via Dan Abramov
* 'master' of https://github.com/facebookincubator/create-react-app:
docs(readme): peer dependencies applied (react#818)
Fix typos on ISSUE_TEMPLATE.md (react#817)
Add explicit linebreaks (react#813)
Fix typo (react#810)
Fix some typos (react#809)
Beaufity output of eject.js script (react#769)
Define process.env as object (react#807)
Typo fix in webpack.config.dev.js comments (react#777)
Add Netlify to deploy instructions
Fix usage example to match react-dev-utils@0.2.x API
Relaxed eslint rule no-unused-expressions (react#724)
Fix the doc
Publish
Add 0.6.1 changelog
Moved Babel and ESLint config to package.json after ejecting (react#773)
Conflicts:
packages/react-scripts/package.json
feiqitian pushed a commit to feiqitian/create-react-app that referenced this pull request Oct 25, 2016
* Beaufity output of eject.js script
* change formatting of the eject.js output and move colors to cyan
* change message about file copy
* add missing three dots to some statements in eject.js script
* change color of "copying files" line and do not repeat copy path anymore in log
* fix merge conflict
* Remove yellow color from "Removing dependency" line
* changing color to "Adding dependency" line
* Add line that outputs which react script is getting replaced by similar node script
* remove not used anymore colors
* add console line about updating Jest configs
* fix typo
* change formatting of replacing script output in eject.js
* remove "Writing package.json" file console output
* make quotes cyan in "Replacing script" console output
* update console log output for Jest, Babel, ESLint update and group them under one statement
* Style nits
maltestenzel pushed a commit to maltestenzel/custom-react-scripts that referenced this pull request Mar 7, 2018
…react-app
# By Dan Abramov (5) and others
# Via Dan Abramov
* 'master' of https://github.com/facebookincubator/create-react-app:
docs(readme): peer dependencies applied (react#818)
Fix typos on ISSUE_TEMPLATE.md (react#817)
Add explicit linebreaks (react#813)
Fix typo (react#810)
Fix some typos (react#809)
Beaufity output of eject.js script (react#769)
Define process.env as object (react#807)
Typo fix in webpack.config.dev.js comments (react#777)
Add Netlify to deploy instructions
Fix usage example to match react-dev-utils@0.2.x API
Relaxed eslint rule no-unused-expressions (react#724)
Fix the doc
Publish
Add 0.6.1 changelog
Moved Babel and ESLint config to package.json after ejecting (react#773)
Conflicts:
packages/react-scripts/package.json
@locklockBot locked and limited conversation to collaborators Jan 22, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@azakordonets@gaearon@montogeek@vjeux@facebook-github-bot