8 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, CSS, and HTML (in order of language usage within the project); thus, we assume you are comfortable in these languages or have basic knowledge of them. Our backend is in NodeJS and we use MongoDB to store our user data. Furthermore, we use Prettier to format our code.
Prerequisites
While most contributions don't require that you install dependencies, there are a few tools you will need to be able to run the project (this is useful and almost always necessary 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 a stable internet connection, a text editor, Git, Firebase, and NodeJS with a version < 14.
Text Editor
If you are not a developer and wish to contribute themes, new languages, or quotes, having a text editor will make contributions much easier. To make complex edits without installing anything, we recommend using GitHub's VS Code web editor. In your fork of Monkeytype(fork it first), go the to Code
tab of the repo and press .(the period/dot key). This will open up the repo in an online VS Code instance you can use to edit files in the browser. Once you are done making your changes, go the to Source Control tab in the activity bar with Ctrl/Cmd + Shift + G, click the +
next to the files you've changed to stage them,type a brief message summarizing the changes made in the commit, and press Ctrl/Cmd + Enter to commit your changes to your fork(send a pull request to the Monkeytype repository when you are ready).
Git
Git is optional but we recommend you utilize it. Monkeytype uses the Git source control management system(SCM) for its version control. Assuming you don't have experience typing commands in the command line, we suggest installing Sourcetree. You will be able to utilize the power of Git without needing to remember any cryptic commands. However using a Git client won't give you access to the full functionality of Git but provides an easy to understand graphical user interface (GUI). Once you have downloaded Sourcetree, run the installer. While installing Sourcetree, keep your eyes peeled for the option to also install Git with Sourcetree. This is the option you will need to look for in order to install Git. Make sure to click yes in the installer to install Git with Sourcetree.
Firebase
-
Create a Firebase account if you already haven't done so.
-
Create a new Firebase project.
- The project name doesn't matter, but the name
monkeytype
would be preferred. - Google Analytics is not necessary.
- The project name doesn't matter, but the name
-
Run
firebase login
on your terminal to log in to the same google account you just used to create the project. -
Git clone this project.
-
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.
- If
-
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
inside thebackend/credentials/
directory. You will have to create the credentials folder.
-
Enable Firebase Authentication
- In the Firebase console, go to
Authentication > Sign-in method
- Click on
Email/Password
, enable it, and save - Click on
Google
, add a support email and save
- In the Firebase console, go to
Mongo Setup
Follow these steps if you want to work on anything involving the database/account system. If not, you can skip this section.
-
Install MongodDB Community Edition and ensure that it is running
-
Inside the backend folder, copy
example.env
to.env
in the same directory. -
Optional - Install MongoDB-compass. This tool can be used to see and manipulate your data visually.
- To connect, type
mongodb://localhost:27017
in the connection string box and press connect. The monkeytype database will be created and shownafter the server is started
.
- To connect, type
NodeJS and NPM
To install NodeJS, navigate to the NodeJS website and download the 14.18.1 LTS
.
Alternatively, if you use nvm
then you can run nvm install && nvm use
to use the version of Node.js in the .nvmrc
file.
Building and Running Monkeytype
Once you have completed the above steps, you are ready to build and run Monkeytype.
- Run
npm install
in the project root directory to install dependencies. - Run
npm run start:dev
(npm run start:dev:nodb
if you skipped the mongo section) to start a local dev server on port 5000. It will watch for changes and rebuild when you edit files insrc/
orpublic/
directories. Note that rebuilding doesn't happen instantaneously so be patient for changes to appear. Use Ctrl+C to kill it.
Standards and Guidelines
Code style is enforced by Prettier, which automatically runs every time you make a commit(git commit
) (if you've followed the above instructions properly).
We recommend following the guidelines below to increase your chances of getting your change accepted.
Theme Guidelines
Before submitting a theme make sure...
- your theme is unique and isn't visually similar to any we already have.
- the text color is either black or white (or very close to these colors)
- your theme has been added to the
_list
file and thetextColor
property is the theme's main color - your theme is clear and readable with both
flip test colors
andcolorful mode
enabled and disabled
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 in the file corresponds to the file name (for example:
languageName.json
is 200 words,languageName_1k.json
is 1000 words, and so on)
Quote Guidelines
- Do not include content that contains any libelous or otherwise unlawful, abusive or obscene text.
- Ensure that your contribution meets JSON standards (no trailing comma at the end of a list)
- Verify quotes added aren't duplicates of any already present
- Verify the
length
property is correct (length of the text in characters) - Verify the
id
property is incremented correctly - Please do not add extremely short quotes (less than 60 characters)
Questions
If you have any questions, comments, concerns, or problems let me know on GitHub, Discord in the #development
channel, or ask a question on Monkeytype's GitHub discussions and a contributor will be happy to assist you.