monkeytype/CONTRIBUTING.md
UnrealApex da5d94d43e
Update CONTRIBUTING.md (#1600)
* Renamed command line setting timer-progress bar

* Added table of contents

* Fixed some mistakes

* More small changes

* Update CONTRIBUTING.md

* updated guidelines

* Update CONTRIBUTING.md

Note that one of the table of contents links is broken, fixing that later

Co-authored-by: Jack <bartnikjack@gmail.com>
2021-07-07 23:12:17 +01:00

7 KiB

Contributing

Table of Contents

Getting Started

When contributing to Monkeytype, it's good to know our best practices, tips, and tricks. First, Monkeytype is written in JavaScript; thus we assume you are comfortable in JavaScript or have basic knowledge of it. We use Prettier to format our code. Our backend is in NodeJS and we use Firebase to store our user data.

Prerequisites

While most contributions don't require that you install dependancies, there are a few minimum requirements you will need to meet to be able to run the project(this is useful and almost always nessicary for tasks like creating features and fixing bugs, running the project is also useful if you are contributing a theme and want to view it on the site before you contribute it). You will need a computer with stable internet connection, NodeJS with a version < 14 and Firebase, and a text editor.

Prerequisite - Text Editor

If you are not a developer and wish to contribute themes, new languages or quotes, having a text editor will make the process much easier. A popular and relativly light-weight editor is the free and open source Visual Studio Code or VS Code for short from Microsoft. Once you have downloaded the binary for your operating system, run the installer and follow the prompts. You will be given some options, but enabling them is just preference. Once you have VS Code installed, you are ready to start contributing.

Prerequisite - Git

Git is optional, but is one thing that is highly recommended. Monkeytype used the Git source control management system for its version control. Without Git, you will be limited to using GitHub's basic online editor for making commits, or will need to make changes and copy-paste them into GitHub. You also won't be able to create save points in your code that you can revert back to (git revert [commit hash])Using Git allows you to make that process more seemless. Assuming you don't have experience with using a command line, I suggest installing Sourcetree. You will be able to utilize the power of Git without needing to remember any cryptic commands. Note that using Git from the a Git client won't give you access to its full functionality. Once you have downloaded Sourcetree, run the installer. If you don't have Git installed and get the option to installed it in the Sourcetree installer, install it. Once you have completed that, you are one step closer to contributing your change.

Prerequisite - NodeJS

Note that this section only covers the installation of NodeJS The installation process of NodeJS is fairly simple, navigate to the NodeJS website and download the xx.xx.x LTS. Your operating system will be detected and the website will ask to save a binary relevant to your operating system. Run the binary and follow the installer.

Prerequisite - Firebase

Note that you will need to create a Firebase account to ensure the further steps are successful.

  1. Create a Firebase account if you already haven't done so.

  2. Create a new Firebase project.

    • The project name doesn't really matter, but the name monkeytype would be prefered.
    • Google Analytics is not necessary.
  3. Install the Firebase CLI

  4. Run firebase login on your terminal to log in to the same google account as you just used to create the project.

  5. Git clone this project.

  6. Duplicate .firebaserc_example, rename the new file to .firebaserc and change the project name of default to the firebase project id you just created.

    • If .firebaserc_example does not exist after cloning, create your own with:
     {
         "projects": {
             "default": "your-firebase-project-id"
         }
     }
    
    • Run firebase projects:list to find your firebase project id.
  7. Generate a Firebase Admin private key

    • In your Firebase console, go to Project Settings > Service Accounts
    • Click "Generate New Private Key"
    • Save as serviceAccountKey.json in the functions/ directory
  8. Enable Firebase Authentication

    • In the Firebase console, go to Authentication
    • Click on Email/Password, enable it and save
    • Click on Google, add a support email and save
  9. Enable Firebase Firestore

    • In the Firebase console, go to Cloud Firestore
    • Create database
    • Start in test mode
    • Select default location and enable

Building and Running Monkeytype

Once you have completed the above steps, you are ready to build and run Monkeytype.

  1. Run npm install in the project root directory to install dependencies.
  2. Run npm run start:dev to start a local dev server on port 5000. It will watch for changes and rebuild when you edit files in src/ or public/ directories. Use control c to abort it.
    • Run firebase use {your-project-id} if you run into any errors for this.

Standards and Guidelines

Code style is enforced by Prettier, which is automatically ran every time you git commit (if you've followed the above instructions properly).

Following the guidelines below will increase your chance of getting your change accepted.

Theme Guidelines

  • Make sure your theme is unique and a simmilar looking one is not already avaiable
  • The text color is either black or white (or very close to)
  • Your theme has been added to the _list file and the textColor property is the theme's main color
  • Your theme is clear and readable with both flip test colors and colorful mode enabled and disbled

Language Guidelines

  • Do not include swear words
  • Ensure that your contribution meets JSON standards (no trailing comma at the end of a list)
  • Be sure to add your language to the _list and _groups files
  • Make sure the number of words corresponds to the file name (for example: languageName.json is 200 words, langugeName_1k.json is 1000 words, and so on)

Quote Guidelines

  • Do not include swear words
  • Ensure that your contribution meets JSON standards (no trailing comma at the end of a list)
  • Verify the length property is correct (length of the text in characters)
  • Verify the id property is incremented correctly

Questions

If you have any questions, comments, concerns, or problems let me know on GitHub or Discord in the #development channel.