-
Notifications
You must be signed in to change notification settings - Fork 27
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
Issue #1691 - Improves installation script #1692
Conversation
… message if necessary
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.
Left a couple of comments.
Generally:
- Would be good to add comments to describe the various commands in this script
- Maybe we should clean up the script to remove nested if statements. Try to keep error checking contained and exit early.
initial_setup.sh
Outdated
if which yarn && [[ `yarn --version` == $YARN_VERSION ]]; then | ||
echo 'Using pre-installed global Yarn'; YARN=yarn | ||
else | ||
if [ -f "./node_modules/.bin/yarn" ] && [[ `./node_modules/.bin/yarn --version` == $YARN_VERSION ]]; then |
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.
What happens if the script is not run from the correct directory?
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.
go to the root repository
It is mentioned in the instructions for README.md
We could have error handling for that but seems a bit far-fetched idea to me.
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.
Good point, maybe add a quick comment in the file itself to keep this assumption close to the source code
initial_setup.sh
Outdated
if ! "$YARN" install; then | ||
echo "Sorry, there seems to be something wrong, please correct the errors and try again" | ||
echo "There was some error installing the required packages, please rectify the errors and try again" | ||
exit 1 |
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.
We should be a bit more descriptive with our error message. Maybe something along the lines of "Unable to run yarn install successfully. You might not be connected to the internet, or there might be a problem with your FROG folder"
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.
That would be displayed by yarn
itself. This just informs the user that his action wasn't successful.
initial_setup.sh
Outdated
exit 0 | ||
echo | ||
echo -e "\xE2\x9C\xA8 Finished Initial Setup." | ||
echo -e "\xF0\x9F\xA4\x93 Run ${LBLUE}npm start server ${NC}to begin hacking!" |
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.
nit: We could move the emojis to constants to help with readability
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.
We could introduce a flag to remove emoji.
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.
Unclear if there is benefit in doing so, this file will normally only be run once
Co-Authored-By: Quentin Golsteyn <[email protected]>
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.
Looks good! We could add some comments indicating the various steps we go through in this script for readability. Something like:
## INSTALLING PYTHON ##
<code goes here>
Very nitpicky so feel free to ignore if you don't have time
As described in #1691 the PR includes some changes which allow for checking exit code before presenting the success message.