|
| 1 | +# How to Contribute |
| 2 | + |
| 3 | +Coderplex [Donations Page](https://donate.coderplex.org/) is a frontend application to accept donations to [Codeplex](https://coderplex.org/) |
| 4 | + |
| 5 | +## Table Of Contents |
| 6 | + |
| 7 | +<!-- START doctoc generated TOC please keep comment here to allow auto update --> |
| 8 | +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
| 9 | +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
| 10 | + |
| 11 | +- [Code of Conduct](#code-of-conduct) |
| 12 | +- [Open Development](#open-development) |
| 13 | +- [Branching Model](#branching-model) |
| 14 | +- [Development Workflow](#development-workflow) |
| 15 | + - [Work on Issues](#work-on-issues) |
| 16 | + - [Proposing a Change](#proposing-a-change) |
| 17 | + - [Prerequisites](#prerequisites) |
| 18 | + - [Sending a Pull Request](#sending-a-pull-request) |
| 19 | + - [Running Locally](#running-locally) |
| 20 | + - [Before submitting](#before-submitting) |
| 21 | + - [Add yourself as a contributor](#add-yourself-as-a-contributor) |
| 22 | + - [Submitting PullRequest](#submitting-pullrequest) |
| 23 | + - [After submitting](#after-submitting) |
| 24 | + - [Received a review request](#received-a-review-request) |
| 25 | + - [How to get in touch](#how-to-get-in-touch) |
| 26 | +- [Appendix](#appendix) |
| 27 | + - [Node Version Manager](#node-version-manager) |
| 28 | + - [nvm for Linux & macOS](#nvm-for-linux--macos) |
| 29 | + - [nvm-windows for Windows](#nvm-windows-for-windows) |
| 30 | + - [Local host occupied](#local-host-occupied) |
| 31 | + |
| 32 | +<!-- END doctoc generated TOC please keep comment here to allow auto update --> |
| 33 | + |
| 34 | +## Code of Conduct |
| 35 | + |
| 36 | +Coderplex has adopted [Contributor Covenant](https://github.com/coderplex/donation-page/blob/master/docs/CODE_OF_CONDUCT.md) that we expect project participants to adhere to. |
| 37 | + |
| 38 | +## Open Development |
| 39 | + |
| 40 | +All work related to the application takes place on Github itself. We use [Issues](https://github.com/coderplex/donation-page/issues) to track bugs, discuss ideas and to engage open source contributors. [Projects](https://github.com/coderplex/donation-page/projects) are used to keep track of everything and is our project management tool. We maintain [Wiki](https://github.com/coderplex/donation-page/wiki) for structuring our long term thoughts. Both core team members and contributors sends a pull request which goes through the same review process. Whole process is as transparent as it can be and we strive to keep it that way. |
| 41 | + |
| 42 | +## Branching Model |
| 43 | + |
| 44 | +The `master` branch of donation-page is relatively stable branch which we use for both development and deployment. We also have auto deployment on this branch itself i.e any changes in that branch gets reflected in [https://donate.coderplex.org](https://donate.coderplex.org). |
| 45 | + |
| 46 | +## Development Workflow |
| 47 | + |
| 48 | +We welcome pull requests from beginners and seasoned JavaScript developers alike! |
| 49 | + |
| 50 | +### Work on Issues |
| 51 | + |
| 52 | +1. Find an issue that needs assistance by searching for the [open issues](https://github.com/coderplex/donation-page/labels/help-wanted). |
| 53 | +1. If you decide to fix an issue, please be sure to check the comment thread in case somebody is already working on a fix. If nobody is working on it at the moment, please leave a comment stating that you intend to work on it so other people don’t accidentally duplicate your effort. |
| 54 | +1. If somebody claims an issue but doesn’t follow up for more than a weeks, it’s fine to take over it but you should still leave a comment. |
| 55 | + |
| 56 | +### Proposing a Change |
| 57 | + |
| 58 | +1. Open a new issue if you would like report a bug or suggest improvements. |
| 59 | +1. Please wait for core team members to comment on the thread. This lets us reach an agreement on your proposal before you put significant effort into it. |
| 60 | + |
| 61 | +### Prerequisites |
| 62 | + |
| 63 | +1. [NodeJS](https://nodejs.org/) |
| 64 | + |
| 65 | + - Currently we are developing using the Node.js v10.x |
| 66 | + |
| 67 | + ```bash |
| 68 | + # To check node version |
| 69 | + node -v |
| 70 | + ``` |
| 71 | + |
| 72 | + Any lower version than mentioned above may face some unexpected behaviour or erros. You can install any version of node along with the version that you have in your machine. For that you need <b>N</b>ode <b>V</b>ersion <b>M</b>anager. |
| 73 | + |
| 74 | + > If you face problem updating your node then you might need a Node version manager tool. [Follow here](#node-version-manager) |
| 75 | +
|
| 76 | +1. [Now CLI](https://zeit.co/download) |
| 77 | + |
| 78 | + - Minimum version v2.x+ |
| 79 | + |
| 80 | + The project depends on the 'now-cli' to run and build. You can install it by running `npm i -g now` |
| 81 | + |
| 82 | +1) [Git](https://git-scm.com/download/) (Familiarity with git is mandatory). |
| 83 | + |
| 84 | +### Sending a Pull Request |
| 85 | + |
| 86 | +*Working on your first Pull Request? You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)* |
| 87 | + |
| 88 | +#### Running Locally |
| 89 | + |
| 90 | +1. Fork the [repository](https://github.com/coderplex/donation-page). |
| 91 | +1. Then clone your forked repository |
| 92 | + ```bash |
| 93 | + git clone <your forked repository url> |
| 94 | + ``` |
| 95 | +1. Move to the repository root folder |
| 96 | + ```bash |
| 97 | + cd donation-page |
| 98 | + ``` |
| 99 | +1. [Yarn](https://yarnpkg.com) |
| 100 | + |
| 101 | + * Minimum version v1.2.0+ |
| 102 | + * Installing instructions are at [official docs](https://yarnpkg.com/en/docs/install#windows-tab). Use yarn over npm |
| 103 | + |
| 104 | + > Our team's official policy (for now) is: We only use [Yarn](https://yarnpkg.com/en/docs/install) as our official Node package manager, and so we request you to use Yarn instead of npm and commit `yarn.lock` file. |
| 105 | +
|
| 106 | +1. Install dependencies |
| 107 | + ```bash |
| 108 | + yarn |
| 109 | + ``` |
| 110 | +1. Setting up with few things, to get it running. |
| 111 | +This project uses some environment variables that hold the values required to make API calls to the API provided by [Razorpay](https://razorpay.com/) and [Airtable](https://airtable.com/). You can ignore this if you're just focussing on the frontend. But, you would need these, if you want to test the API calls made to process the payments or make changes to the API. |
| 112 | + |
| 113 | + Create two files named `.env` and `.env.build` and those files should look something like this. |
| 114 | + contents of `.env` file: |
| 115 | + ``` |
| 116 | + RZP_TEST_KEY=YOUR_TEST_KEY(optional) |
| 117 | + RZP_TEST_SECRET=YOUR_TEST_SECRET(optional) |
| 118 | + RZP_LIVE_KEY= |
| 119 | + RZP_LIVE_SECRET= |
| 120 | + AIRTABLE_KEY= |
| 121 | + AIRTABLE_BASE_ID= |
| 122 | + AIRTABLE_TABLE_NAME= |
| 123 | + ``` |
| 124 | + |
| 125 | + contents of `.env.build` file: |
| 126 | + |
| 127 | + ``` |
| 128 | + RZP_TEST_KEY=YOUR_TEST_KEY(optional) |
| 129 | + RZP_LIVE_KEY= |
| 130 | + ``` |
| 131 | +1. Start the development server |
| 132 | + ```bash |
| 133 | + yarn dev |
| 134 | + ``` |
| 135 | + Go to `localhost:3000` in the browser of your choice. |
| 136 | + > You may get this [error](#local-host-occupied) if any other app is already running the above port. |
| 137 | +
|
| 138 | +#### Before submitting |
| 139 | + |
| 140 | +1. From your fork, create a [branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/) and name it accordinly. eg. `typo-in-readme` or `issue-resolve-6` or `patch-fix-3` |
| 141 | +1. If you’ve fixed a bug or added code that should be tested, add tests! |
| 142 | +1. Ensure that all test pass |
| 143 | + ```bash |
| 144 | + yarn test |
| 145 | + ``` |
| 146 | +1. Run code formatters |
| 147 | + ```bash |
| 148 | + yarn lint |
| 149 | + ``` |
| 150 | +1. Add and commit your code. Please give meaning full commit messages and add what you've changed or added in the decription in brief so that it can be easy for reviewers to understand. |
| 151 | + |
| 152 | +#### Add yourself as a contributor |
| 153 | + |
| 154 | +This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! |
| 155 | + |
| 156 | +To add yourself to the table of contributors on the `README.md`, please use the automated script as part of your PR: |
| 157 | + |
| 158 | +```bash |
| 159 | +yarn run add-contributor |
| 160 | +``` |
| 161 | + |
| 162 | +Follow the prompt and commit `.all-contributorsrc` and `README.md` in the PR. |
| 163 | + |
| 164 | +#### Submitting PullRequest |
| 165 | + |
| 166 | +1. Pull latest code from [upstream repository's](https://help.github.com/articles/merging-an-upstream-repository-into-your-fork/)`master`, if in case anything new were merged while you were working on your fork. |
| 167 | +1. Push the code to your fork. |
| 168 | +1. Raise the pull request from your created branch to `master` branch of coderplex. |
| 169 | +1. Take some time to give a brief description of the work you have done. |
| 170 | + |
| 171 | +#### After submitting |
| 172 | + |
| 173 | +1. Wait for all checks to pass in below section. |
| 174 | + > You might see a check fail from now-bot saying that there are failures in deployment. Don't worry about it, you don't have access rights to deploy. You can see the status of your check once any reviewer triggers the deployment. |
| 175 | +1. The core team will review your pull request and either merge it, request changes to it, or close it with an explanation. |
| 176 | +<!-- 1. Your changes are deployed with a unique link `https://deploy-preview-xx--coderplex.netlify.com`. |
| 177 | +
|
| 178 | + _`- xx` is your pull request number._ --> |
| 179 | + |
| 180 | + |
| 181 | +##### Received a review request |
| 182 | + |
| 183 | +- Work on the requested changes |
| 184 | +- Push the changes as you did earlier, the pull request will automatically catch those and update itself. |
| 185 | + |
| 186 | +### How to get in touch |
| 187 | + |
| 188 | +- Coderplex [Discord Channel](https://discord.gg/ydaGAG) |
| 189 | +- Tweet core team members : |
| 190 | + - Vinay Puppal [@VinayPuppal](https://twitter.com/vinaypuppal) |
| 191 | + |
| 192 | +## Appendix |
| 193 | + |
| 194 | +### Node Version Manager |
| 195 | + |
| 196 | +#### [nvm](https://github.com/creationix/nvm) for Linux & macOS |
| 197 | + |
| 198 | +```bash |
| 199 | +# Installation |
| 200 | +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash |
| 201 | + |
| 202 | +# Install latest node lts |
| 203 | +nvm install --lts |
| 204 | + |
| 205 | +# Use installed version |
| 206 | +nvm use --lts |
| 207 | + |
| 208 | +# Run the app in the same terminal session |
| 209 | +``` |
| 210 | + |
| 211 | +_Make sure you have [curl](https://curl.haxx.se/) installed_ |
| 212 | + |
| 213 | +#### [nvm-windows](https://github.com/coreybutler/nvm-windows) for Windows |
| 214 | + |
| 215 | +It comes with an [installer](https://github.com/coreybutler/nvm-windows#installation--upgrades). |
| 216 | + |
| 217 | +```bash |
| 218 | +# Install particular version |
| 219 | +nvm install 8.9.1 |
| 220 | + |
| 221 | +# Use installed version |
| 222 | +nvm use 8.9.1 |
| 223 | +``` |
| 224 | + |
| 225 | +Still facing problem this [article](https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47) from [@skounis](https://twitter.com/skounis) explain in details. |
| 226 | + |
| 227 | +### Local host occupied |
| 228 | + |
| 229 | +```js |
| 230 | +Error: listen EADDRINUSE :::3000 |
| 231 | + at Object._errnoException (util.js:1024:11) |
| 232 | + at _exceptionWithHostPort (util.js:1046:20) |
| 233 | + at Server.setupListenHandle [as _listen2] (net.js:1351:14) |
| 234 | + at listenInCluster (net.js:1392:12) |
| 235 | + at Server.listen (net.js:1476:7) |
| 236 | + at app.prepare.then (/home/m-zubairahmed/github/official/coderplex-frontend/server.js:26:6) |
| 237 | + at <anonymous> |
| 238 | + at process._tickCallback (internal/process/next_tick.js:188:7) |
| 239 | +error Command failed with exit code 1. |
| 240 | +``` |
| 241 | + |
| 242 | +If you get this error while running `yarn dev` then probably another app is occupying `localhost:3000`. You may want to close that and run the command again. |
0 commit comments