We welcome pull requests from Free Code Camp campers (our students) and seasoned JavaScript developers alike! Follow these steps to contribute:
我们欢迎每一位 FreeCodeCamp学员 和 有经验的JavaScript开发人员 给我们发送 pull requests!请参照下面这些步骤参与进来:
If you've found a bug that is not on the board, follow these steps.
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 I fix something specific to email login.npm test
and ensure all tests pass. For Windows contributors, skip the jsonlint pretest run by using npm run test-challenges
, as jsonlint will always fail on Windows, given the wildcard parameters.staging
branch. Travis CI will then take your code and run npm test
. Make sure this passes, then we'll do a quick code review and give you feedback, then iterate from there.Note: If this is your first time working with a node-gyp dependent module, please follow the node-gyp installation guide to ensure a working npm build.
The easiest way to get started is to clone the repository:
# Get the latest snapshot
git clone --depth=1 https://github.com/huluoyang/freecodecamp.cn.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
Private Environment Variables (API Keys)
# Create a copy of the "sample.env" and name it as ".env".
# Populate it with the necessary API keys and secrets:
cp sample.env .env
Edit your .env
file and modify the API keys only for services that you will use.
Note : Not all keys are required, to run the app locally, however MONGOHQ_URL
is the most important one.
If you only use email login, in addition to MONGOHQ_URL
, SESSION_SECRET
, add the MANDRILL_USER
and MANDRILL_PASSWORD
API Keys. Not setting these keys will throw an exception when you sign up which you can ignore, you will still be able to login, however you may get these keys here. Sign up and create a new pair of keys.
You can leave the other keys as they are. Keep in mind if you want to use more services you'll have to get your own API keys for those services and edit those entries accordingly in the .env
file.
# Start the mongo server in a separate 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.
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. The reason we enforce this is because one of our dependent NPM modules, jsonlint, does not fully support wildcard paths in Windows.
Do not file an issue until you have followed these steps:
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:
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.
staging
.staging
branch using git status
:$ git status
On branch staging
Your branch is up-to-date with 'origin/staging'.
nothing to commit, working directory clean
git checkout staging
staging
with git: git checkout -B branch/name-here
fix/short-fix-description
or feature/short-feature-description
. Review the Contribution Guidelines for more detail.git status
to see unstaged files.git add path/to/filename.ext
You can also do: git add .
to add all unstaged files. Take care, though, because you can accidentally add files you don't want added. Review your git status
first.git commit -m "Brief Description of Commit"
git push -u origin branch/name-here
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
staging
branch.staging
branch.Add Test Cases to Bonfire Drop It
Correct typo in Waypoint Size Your Images
closes
and #xxxx (where xxxx is the issue number). Example: closes #1337
.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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。