We welcome pull requests from Free Code Camp campers (our students) and seasoned JavaScript developers alike! Follow these steps to contribute:
- Check our public Waffle Board.
- Pick an issue, let us know you're working on it, and start working on it. If you've found a bug that is not on the board, follow these steps.
- You can find issues we are seeking assistance on by searching for the Help Wanted tag.
- Feel free to ask for help in our Help Contributors Gitter room.
- Fork the project: How To Fork And Maintain a Local Instance of Free Code Camp
- Create a branch specific to the issue or feature you are working on. Push your work to that branch. (Need help with branching?)
- Name the branch something like
fix/xxx
orfeature/xxx
wherexxx
is a short description of the changes or feature you are attempting to add. For examplefix/email-login
would be a branch where I fix something specific to email login. - You should have ESLint running in your editor, and it will highlight anything doesn't conform to Free Code Camp's JavaScript Style Guide (you can find a summary of those rules here. Please do not ignore any linting errors, as they are meant to help you and to ensure a clean and simple code base. Make sure none of your JavaScript is longer than 80 characters per line.
- Squash your Commits. Ref: rebasing
- Once your code is ready, submit a pull request from your branch to Free Code Camp's
staging
branch. We'll do a quick code review and give you feedback, then iterate from there.
The easiest way to get started is to clone the repository:
# Get the latest snapshot
git clone --depth=1 https://github.com/freecodecamp/freecodecamp.git freecodecamp
# Change directory
cd freecodecamp
# Install NPM dependencies
npm install
# Install Gulp globally
npm install -g gulp
# Install Bower globally
npm install -g bower
# Install Bower dependencies
bower install
# Create a .env file and populate it with the necessary API keys and secrets:
touch .env
Edit your .env
file with the following API keys accordingly. If you only use email login, only the MONGOHQ_URL
, SESSION_SECRET
, MANDRILL_USER
and MANDRILL_PASSWORD
fields are necessary. Keep in mind if you want to use more services you'll have to get your own API keys for those services. If you only use a subset or no OAuth2 authentication methods, you may want to remove them from server/passport-providers.js
- otherwise the server will complain about missing clientIDs at launch.
MONGOHQ_URL='mongodb://localhost:27017/freecodecamp'
FACEBOOK_ID=stuff
FACEBOOK_SECRET=stuff
GITHUB_ID=stuff
GITHUB_SECRET=stuff
GOOGLE_ID=stuff
GOOGLE_SECRET=stuff
LINKEDIN_ID=stuff
LINKEDIN_SECRET=stuff
MANDRILL_PASSWORD=stuff
MANDRILL_USER=stuff
TRELLO_KEY=stuff
TRELLO_SECRET=stuff
TWITTER_KEY=stuff
TWITTER_SECRET=stuff
TWITTER_TOKEN=stuff
TWITTER_TOKEN_SECRET=stuff
BLOGGER_KEY=stuff
SESSION_SECRET=secretstuff
COOKIE_SECRET='this is a secret'
PEER=stuff
DEBUG=true
# Start the mongo server in a seperate terminal
mongod
# Initialize Free Code Camp
# This will seed the database for the first time.
# This command should only be run once.
npm run only-once
# start the application
gulp
Now navigate to your browser and open http://localhost:3001 If the app loads, congratulations - you're all set. Otherwise, let us know by opening a GitHub issue and with your error.
Do not file an issue until you have followed these steps:
- Read Help I've Found a Bug wiki page and follow the instructions there.
- Asked for confirmation in the appropriate Help Room
- Please do not open an issue without a 3rd party confirmation of your problem.
What is a Pull Request?
A pull request (PR) is a method of submitting proposed changes to the Free Code Camp Repo (or any Repo, for that matter). You will make changes to copies of the files which make up Free Code Camp in a personal fork, then apply to have them accepted by Free Code Camp proper.
Need Help?
Free Code Camp Issue Mods and staff are on hand to assist with Pull Request related issues on our Help Contributors Chat Room
Methods
There are two methods of creating a Pull for Free Code Camp:
- Editing files via the GitHub Interface
- Editing files on a local clone
Important: ALWAYS EDIT ON A BRANCH
Take away only one thing from this document, it should be this: Never, EVER make edits to the staging
branch. ALWAYS make a new branch BEFORE you edit files. This is critical, because if your PR is not accepted, your copy of staging will be forever sullied and the only way to fix it is to delete your fork and re-fork.
Method 1: Editing via your Local Fork (Recommended)
This is the recommended method. Read about How to Setup and Maintain a Local Instance of Free Code Camp.
- Perform the maintenance step of rebasing
staging
. - Ensure you are on the
staging
branch usinggit status
:
$ git status
On branch staging
Your branch is up-to-date with 'origin/staging'.
nothing to commit, working directory clean
- If you are not on staging or your working directory is not clean, resolve any outstanding files/commits and checkout staging
git checkout staging
- Create a branch off of
staging
with git:git checkout -B branch/name-here
Note: Branch naming is important. Use a name likefix/short-fix-description
orfeature/short-feature-description
. Review the Contribution Guidelines for more detail. - Edit your file(s) locally with the editor of your choice
- Check your
git status
to see unstaged files. - Add your edited files:
git add path/to/filename.ext
You can also do:git add .
to add all unstaged files. Take care, though, because you can accidentially add files you don't want added. Review yourgit status
first. - Commit your edits:
git commit -m "Brief Description of Commit"
- Squash your commits, if there are more than one.
- Push your commits to your GitHub Fork:
git push -u origin branch/name-here
- Go to Common Steps
Method 2: Editing via the GitHub Interface
Note: Editing via the GitHub Interface is not recommended, since it is not possible to update your fork via GitHub's interface without deleting and recreating your fork.
Read the Wiki article for further information
- Once the edits have been committed, you will be prompted to create a pull request on your fork's Github Page.
- By default, all pull requests should be against the FCC main repo,
staging
branch. - Submit a pull request from your branch to Free Code Camp's
staging
branch. - The title (also called the subject) of your PR should be descriptive of your changes and succinctly indicates what is being fixed.
- Do not add the issue number in the PR title.
- Examples:
Add Test Cases to Bonfire Drop It
Correct typo in Waypoint Size Your Images
- In the body of your PR include a more detailed summary of the changes you made and why.
- If the PR is meant to fix an existing bug/issue, then, at the end of your PR's commit message, append the keyword
closes
and #xxxx (where xxxx is the issue number). Example:closes #1337
.
This tells GitHub to close the existing issue, if the PR is merged.
- If the PR is meant to fix an existing bug/issue, then, at the end of your PR's commit message, append the keyword
- Indicate if you have tested on a local copy of the site or not.
If your PR is accepted
Once your PR is accepted, you may delete the branch you created to submit it. This keeps your working fork clean.
You can do this with a press of a button on the GitHub PR interface. You can delete the local copy of the branch with: git branch -D branch/to-delete-name
If your PR is rejected
Don't despair! You should receive solid feedback from the Issue Moderators as to why it was rejected and what changes are needed.
Many Pull Requests, especially first Pull Requests, require correction or updating. If you have used the GitHub interface to create your PR, you will need to close your PR, create a new branch, and re-submit. This is because you cannot squash your commits via the GitHub interface.
If you have a local copy of the repo, you can make the requested changes and amend your commit with: git commit --amend
This will update your existing commit. When you push it to your fork you will need to do a force push to overwrite your old commit: git push --force
Be sure to post in the PR conversation that you have made the requested changes.
##Other resources