These guidelines are based off those of freeCodeCamp, protected under the BSD 3-Clause License.
Prerequisite | Version |
---|---|
Node.js | ^16 |
npm (comes with Node) | ^8 |
What's the difference between a tilde (~) and a caret (^) in a npm package.json file?.
If Node.js is already installed on your machine, run the following commands to validate the versions:
node -v
- Install Git or your favorite Git client.
- (Optional) Set Up an SSH Key for GitHub.
- Go to the top level stuyspec.com repository: https://github.com/stuyspec/stuyspec.com
- Click the "Fork" Button in the upper right hand corner of the interface (More Details Here)
- After the repository (repo) has been forked, you will be taken to your copy of the stuyspec.com repo at https://github.com/YOUR_USERNAME/stuyspec.com
- Open a Terminal / Command Line / Bash Shell in your projects directory (i.e.:
/yourprojectdirectory/
) - Clone your fork of stuyspec.com
$ git clone https://github.com/YOUR_USERNAME/stuyspec.com.git
This will download the entire stuyspec.com repo to your projects directory.
- Change directory to the new stuyspec.com directory (
cd stuyspec.com
) - Add a remote to the official stuyspec.com repo:
$ git remote add upstream https://github.com/stuyspec/stuyspec.com.git
Congratulations, you now have a local copy of the stuyspec.com repo!
Now that you have a copy of your fork, there is work you will need to do to keep it current.
Do this prior to every time you create a branch for a pull request (PR):
- Make sure you are on the
develop
branch
$ git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
If your aren't on develop
, resolve outstanding files / commits and checkout the develop
branch
$ git checkout develop
- Do a pull with rebase against
upstream
$ git pull --rebase upstream develop
This will pull down all of the changes to the official develop branch, without making an additional commit in your local repo.
Once you have stuyspec.com cloned, before you start the application, you first need to install all of the dependencies:
# Install NPM dependencies
npm install
By default, stuyspec.com will try to connect to a local version of the api server hosted at http://api.localhost:3000. However, when starting, it's simpler to point stuyspec.com to the production API and use real data. To do that, set REACT_APP_API_URL
in .env.development
to https://api.stuyspec.com.
Now you can start the application:
npm start
Now navigate to your browser and open http://localhost:3002. If the app loads, congratulations---you're all set.
If you ever want to test with your own data, you will need to set up our API on localhost. To use that server, you'll want to change REACT_APP_API_URL
in .env.development
back to http://api.localhost:3000.
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.
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.
To create a branch on your local machine (and switch to this branch):
$ git checkout -b [name_of_your_new_branch]
and to push to GitHub:
$ git push origin [name_of_your_new_branch]
If you need more help with branching, take a look at this.
This bit is up to you!
When you're ready to share your code, create a pull request.
A pull request (PR) is a method of submitting proposed changes to the stuyspec.com repo (or any repo, for that matter). You will make changes to copies of the files which make up stuyspec.com in a personal fork, then apply to have them accepted by a stuyspec.com maintainer.
- Perform the maintenance step of rebasing
develop
. - Ensure you are on the
develop
branch usinggit status
:
$ git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
nothing to commit, working directory clean
-
If you are not on develop or your working directory is not clean, resolve any outstanding files/commits and checkout develop
git checkout develop
-
Create a branch off of
develop
with git:git checkout -B branch/name-here
Note: Branch naming is important. Use a name likefix/short-fix-description
orfeature/short-feature-description
. -
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 accidentally add files you don't want added. Review yourgit status
first. -
Commit your edits. Refer to Writing good commit messages.
-
Push your commits to your GitHub Fork:
git push origin branch/name-here
In your web browser go to your repository fork's GitHub Page.
-
Once the edits have been committed, you will be prompted to create a pull request on that page.
-
By default, all pull requests should be against the stuyspec.com main repo,
develop
branch. -
Submit a pull request to stuyspec.com's
develop
branch. -
The title (also called the subject) of your PR should be descriptive of your changes and succinctly indicates what is being fixed.
- Examples:
Add Test Cases to Bonfire Drop It
Correct typo in Waypoint Size Your Images
- Examples:
-
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 description, 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 description, append the keyword
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