# Developer Guide

## Overview

This project was developed predominantly using React and JavaScript. Technologies that were used other than the ones mentioned above include:

* GraphQL
* CSS
* Apollo Client
* AWS Cognito

This project leverages the common back end that was developed through AWS Lambda.

## Instructions for Local Development <a href="#instructions-for-local-development" id="instructions-for-local-development"></a>

### Prerequisites/Environment <a href="#prerequisites-environment" id="prerequisites-environment"></a>

* A MacOS/Linux/Windows powered Computer
* Git and GitHub Account
* NPM (Node Package Manager) installed locally

### Step 1

On your local machine type the following command to clone our repo to your local machine.

git clone <https://github.com/CPSECapstone/Flipted-Hydro.git>

### Step 2 <a href="#step2" id="step2"></a>

Run the following command to install all of the necessary packages of our code base:

npm i

Note: If you run into an issue where a dependency cannot be resolved try the following:

* Manually install the package (npm i \[package name]).
* Remove node modules and run npm i again.

### Step 3

Create a .env file and add the necessary sensitive information. For security purposes this cannot be shared via this gitbook. Please contact a developer for the necessary info.

### Step 4 <a href="#step4" id="step4"></a>

That's it! You should be ready to start the project and begin development, run the following command to start the app.

npm start

Note: Read the below section on Merging and Pull Requests before you begin development.

## Merging and Pull Requests <a href="#merging-and-pull-requests" id="merging-and-pull-requests"></a>

Changes in this project are done through GitHub and pull requests. Follow the following instructions to do so:

* git checkout -b \[branch name] (This creates a new branch specific to your change, you may do this before or after you do your changes)

If you did your changes before:

* git checkout main (Checks out local version of main)
* git reset --hard origin/main (Resets local version to updated version of main)
* git checkout \[branch name] (Checkout change specific branch)
* git merge main (Merges main into branch with changes)

If you did your changes after:

* git checkout main (Checks out local version of main)
* git pull (Updates local version with the latest on GitHub)
* git checkout \[branch name] (Checkout change specific branch)
* git merge main (Merges main into branch with changes)

Git will try to automatically resolve conflicts but more often than not, you will have to do so yourself.

Once conflicts are resolved:

* git add \[files changed/ edited] -set--up
* git commit -m "\[Commit Message]"
* git push --set-upstream origin \[branch name]

Your should now have a branch with your changes. Create a PR (pull request) and wait for two approvals from developers. Once you receive two approvals Merge your changes into main.

Congrats! You have just contributed to Flipted.&#x20;

## Testing

We use the ever popular Jest Framework in combination with the React Testing Framework for our unit tests. All Tests are under the Test Directory, which is inside the src directory. We request that this convention be honored for ease of development.

To run all test suites:

npm test

To run an individual test suite

npm test \[relative path of the test file]

Your files should end with a .test.js. You should add unit tests for changes you make wherever applicable. You should run all the test suites to verify that your changes did not cause a break in the codebase.

## Deployment

This application is currently deployed through Heroku. To deploy changes/new version, merge main into the prod branch. This will trigger an automatic build and deployment.

Note: This may take up to 40 minutes.
