FCC-Alumni / alumni-network

The official home of the freeCodeCamp Alumni Network :star: :star: :star:
https://fcc-alumni.com
BSD 3-Clause "New" or "Revised" License
70 stars 17 forks source link

CONTRIBUTING.md #173

Closed no-stack-dub-sack closed 7 years ago

no-stack-dub-sack commented 7 years ago

Starting a draft of the file here...

no-stack-dub-sack commented 7 years ago

Contributor's Guide

Contents

Prerequisites

Prerequisite Version
MongoDB ~ ^3
Redis ~ ^3.2
Node.js ~ ^6
npm (comes with Node) ~ ^3

Updating to the latest releases is recommended.

If Node, MongoDB, or Redis are already installed on your machine, run the following commands to validate the versions:

$ node -v
$ mongo --version
$ redis-server --version

If your versions are lower than the prerequisite versions, you should update.

Getting Started

IMPORTANT: If you have never contributed to an open source project before, are unfamiliar with the git workflow, or need assistance with creating a local copy of the freeCodeCamp Alumni Network (FCCAN) repo, branching, branch naming conventions, etc., please see the Getting Started guide here.

Setting Up freeCodeCamp Alumni Network

Once you've established a local copy of FCCAN, you will need to do a few things before launching the application for the first time:

Install all of the project's dependencies:

Secrets and API keys:

SESSION_SECRET=thisisasupercoolsessionsecretthatonlyIknow

GITHUB_CLIENT_ID= GITHUB_SECRET=

- LinkedIn and Twitter API keys are optional and are only required if you will be developing against the features that utilize these APIs. 

**Populating the Database and Running the App:**
- To run the app, you will need a minimum of 4 terminal/command prompt tabs for each of the following processes, which must be running for the app to work: `create-react-app` dev-server, NodeJS server, MongoDB, and Redis.
- First, launch MongoDB and Redis:
```bash
# in your first tab, in any directory, run:
$ mongod
# if you are a mac user and get an error, you may need to run:
$ sudo mongod
# and enter your password
#
# now, in your second tab, also in any directory, run:
$ redis-server

BONUS: In addition to the 4 tabs required to run the app's various servers and databases, we recommend utilizing at least 2 other command prompt/terminal tabs. One for interacting with MongoDB (which you can do by running $ mongo from the command line), and another for general navigation, additional commands, and for managing the project's Git workflow.

Running the App

SUMMARY: To summarize the previous section, and for running FCCAN each time after initial setup, the commands are:

# Tab 1: Run MongoDb
$ mongod
# Tab 2: Run Redis
$ redis-server
# Tab 3: Run NodeJS Server
$ npm run dev
# Tab 4: Run CRA dev-server
$ cd client
$ npm start

If you are not FCC Certified, Please Read!

NOTE: Our registration process requires that users have a GitHub account, a freeCodeCamp account, and at least one FCC certification to join. However, we do not want this limitation to prevent potential contributors from gaining access to the application for development.

If you are not FCC certified, we have included a workaround setting that can be changed for development only:

Dev Tools & Other Utilities

NOTE: We built this project using Chrome as our default browser, and for the best development experience and seamless dev-tools integration, we recommend you do the same.

  • This project is configured to use both React and Redux dev tools. You can get them for Chrome here:
  • React
  • Redux
  • Another useful utility that's value goes beyond the scope of this project is Mongo Hacker. This package is a series of Mongo Shell enhancements that makes interacting with MongoDB from the command line more seamless and less visually taxing.
  • It can be installed by running the following commands: NOTE: Do not run these commands in the FCCAN project directory, you should run these in your project's parent directory, e.g. /Users/your_name/myCodingProjects, or in another preferred directory.
    $ git clone --depth=1 https://github.com/TylerBrock/mongo-hacker.git
    $ cd mongo-hacker
    $ make install

Using the Mongo Shell

NOTE: For more complete documentation, please see the Mongo Shell documentation here.

  • While working on this project, you may find it helpful to interact with MongoDB from Mongo's built in Mongo Shell. You can access this shell by using the following command from your command prompt/terminal:
    $ mongo
  • Here are some helpful commands and tips to get you started:
    # before running any of the following commands
    # switch to the FCCAN database by using:
    $ use alumninetwork
    #
    # list all collections within alumninetwork db:
    $ show collections
    #
    # see all entries of a particular collection
    # ex:
    $ db.users.find({})
    # or 
    $ db.privateChat.find({})
    # 
    # these searches can be refined further:
    $ db.users.find({ username: "no-stack-dub-sack" })
    #
    # you may occasionally want to reset your project's DB to test
    # certain features like registration (which you will only go through
    # the first time your user document is added to the database):
    $ db.dropDatabase()
    # WARNING: this cannot be undone and is tantamount to deleting 
    # all of your project's stored data! If you need to preserve your 
    # current settings, this is NOT recommended.
  • Like in other shells, note that you can use the and keys to cycle through recent commands.
  • There are other commands that you may find helpful, so don't forget to check out the documentation!

Semantic-UI / Semantic-UI React

For responsive design, layout, theming, and general UI design, we have chosen to utilize Semantic-UI over some of the more common libraries like Bootstrap. We made this choice for 2 reasons: 1) We already knew Bootstrap and we wanted to learn something new, and 2) Semantic-UI rocks! We think you'll like working with it too.

Some notes on Semantic-UI:

On Theming:

Color Class Name
Green green
Dark Green teal
Red red
Grey grey
Dark Grey black
Light Red pink

SASS / Styled-Components

Consistency is fantastic! However, this project isn't. At least from a CSS standpoint 😄 . While we relied heavily on Semantic-UI for our general UI design and styles, more granular styles are always necessary to achieve the right level of control. For this, we used 3 different approaches to styling the UI:

Why Styled-Components?

When to use Styled-Component and When to Not:

Some Tips:

const Text = styled.span border: 1px solid red; ${ thisFucntionReturnsCss() } ;


- Our [`hoverTransition`](https://github.com/FCC-Alumni/alumni-network/blob/master/client/src/styles/style-utils.js#L39) function is a great example of a reusable, global style that can be invoked in any styled-component (since all styled-components rely on template literals).  
- This code might not make sense out of context, however, this is a very powerful concept that's worth pointing out. And after checking out our codebase and the Styled-Components docs, this will all make much more sense! 

### This file is a WIP!
no-stack-dub-sack commented 7 years ago

Getting Started

Forking The Project

Setting Up Your System

  1. Install Git or your favorite Git client.
  2. (Optional) Setup an SSH Key for GitHub.
  3. Create a parent projects directory on your system.

Forking freeCodeCamp Alumni Network

  1. Go to the freeCodeCamp Alumni Network (FFCAN) repository: https://github.com/FCC-Alumni/alumni-network
  2. Click the "Fork" Button in the upper right hand corner of the interface (More Details Here)
  3. After the repository has been forked, you will be taken to your copy of the FCCAN repo at yourUsername/alumni-network

Cloning Your Fork

  1. Open a Terminal / Command Line / Bash Shell in your projects directory (i.e.: /yourprojectdirectory/)
  2. Clone your fork of FCCAN
$ git clone https://github.com/<yourUsername>/alumni-network.git
(make sure to replace <yourUsername> with your GitHub Username)

This will download the entire FCCAN repo to your project's directory.

Setup Your Upstream

  1. Change directory to the new FCCAN directory (cd alumni-network)
  2. Add a remote to the official FCCAN repo:
$ git remote add upstream https://github.com/FCC-Alumni/alumni-network.git

Congratulations, you now have a local copy of the FCCAN repo!

Maintaining Your Fork

Now that you have a copy of your fork, there is work you will need to do to keep it current.

Rebasing from Upstream

Do this prior to every time you create a branch for a PR:

  1. Make sure you are on the master branch
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

If your aren't on master, resolve outstanding files / commits and checkout the master branch

$ git checkout master
  1. Do a pull with rebase against upstream
$ git pull --rebase upstream master

This will pull down all of the changes to the official master branch, without making an additional commit in your local repo.

  1. (Optional) Force push your updated master branch to your GitHub fork
$ git push origin master --force

This will overwrite the master branch of your fork.

Create A Branch

Before you start working, you will need to create a separate branch specific to the issue / feature you're working on. You will push your work to this branch.

Naming Your Branch

Name the branch something like fix/xxx or feature/xxx where xxx is a short description of the changes or feature you are attempting to add. For example fix/email-login would be a branch where you fix something specific to email login.

Adding Your Branch

To create a branch on your local machine (and switch to this branch):

$ git checkout -b [name_of_your_new_branch] 

For example:

$ git checkout -b fix/minor-typo

and to push to GitHub:

$ git push origin fix/minor-type
If you need more help with branching, take a look at this.
bonham000 commented 7 years ago

@no-stack-dub-sack overall this looks great! Some notes:

And the last thing is that hopefully we'll consolidate the current beta issues and the other ideas we collected in a nice organized way (I guess just as issues) and then present those within the Contributing guide (as in just be like hey there are a lot of issues ready) as known challenges that would be good targets for someone looking to make a contribution — with the idea being that we're trying to facilitate a learning environment for someone to make open-source contributions.

no-stack-dub-sack commented 7 years ago

@bonham000

And, we'll need something somewhere that explains how to actually run the app which I assume you were going to add.

☝️ for sure, not quite done yet, just haven't gotten there yet

Then I assume we'll have to suggest the user configures their on GitHub authentication credentials and adds those on their own.

☝️ Actually, I had already written this part, and is one of the main things I wanted you to look over to make sure it all looks right. See the 3rd bullet of the "Secrets and API Keys" section

We may not need the line about forcing pushing their local copy back to GitHub, it's not really necessary for them to push master back to their remote fork.

:point_up: agreed, but also can't hurt. I'm indifferent on whether its kept or not.

As far as rebasing goes, it can't hurt - for more experienced contributors, they will know the difference, for newer ones, rebasing is a safer bet I think

The script for setup is a good idea, I left a comment above about that!

no-stack-dub-sack commented 7 years ago

resolved :-)