Skip to content

Latest commit

 

History

History
104 lines (65 loc) · 4.33 KB

CONTRIBUTING.md

File metadata and controls

104 lines (65 loc) · 4.33 KB

Contributing Guide

Hello! We'd love to see your contribution on this repository soon, even if it's just a typo fix!

Contributing means anything from reporting bugs, ideas, suggestion, code fix, even new feature.

Bear in mind to keep your contributions under the Code of Conduct for the community.

Bug report, ideas, and suggestion

The issues page is a great way to communicate to us. Other than that, we have a Telegram group that you can discuss your ideas into. If you're not an Indonesian speaker, it's 100% fine to talk in English there.

Please make sure that the issue you're creating is in as much detail as possible. Poor communication might lead to a big mistake, we're trying to avoid that.

Pull request

A big heads up before you're writing a breaking change code or a new feature: Please open up an issue regarding what you're working on, or just talk in the Telegram group.

Prerequisites

You will need a few things to get things working:

  1. Node.js current version (as of now, we're using v18.16.0 as defined in the .nvmrc file). You can install it through the official Node.js download page, but we recommend using nvm or fnm. Here's a simple installation/setup guide, but you should really refer directly to the corresponding repository's README.
# If you want to install fnm
$ curl -fsSL https://fnm.vercel.app/install | bash

# Then simply use this command
$ fnm use

# OR if you want to install nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

$ nvm use
  1. This repo uses pnpm workspace to share the code between the backend and the frontend. There are multiple ways to install pnpm, please refer to the official installation guide for pnpm

  2. Docker and Docker Compose if you want to test the app using docker. (Optional)

Getting Started

  1. Fork this repository to your own Github account and clone it to your local device.
  2. Run pnpm install to install the dependencies needed across all workspaces.
  3. You can use postman, insomnia or hoppscotch to create an API request.

Conventional commit is not required in this repo since this was supposed to be a toy project but ended up to be a kinda serious-ish thing. Do whatever you want with the commit message :)

Testing your change

Backend

It's really up to you to have an unit test or not. But if you do, just create one on the tests directory, and run the test with:

# single run
pnpm test

# watch
pnpm test:watch

# collect coverage
pnpm test:coverage

We're using Vitest as the test runner.

Before creating a PR

Please run ESLint and Prettier with these commands so you're good on the CI process.

pnpm lint
pnpm fmt:write # or fmt:check if you don't want prettier to automatically format your code

And you're set!

NPM scripts

Available on both workspaces

  • pnpm install - Your typical 5 million packages installation.
  • pnpm start - Start the fun stuff, make sure you've run the build step before running this.
  • pnpm dev - When you want stuff to be automagically reloaded.
  • pnpm lint - Check the files from your silly mistakes.
  • pnpm lint:fix - Fix your mistakes
  • pnpm fmt:check - Feeling your code isn't pretty?
  • pnpm fmt:write - You like pretty formatted code, right?

Extra command for frontend

  • pnpm build - Build everything into a static files.

Extra command for backend

  • pnpm test - Make sure everything works correctly.
  • pnpm test:watch - When you can't be bothered to run pnpm test multiple times.
  • pnpm test:coverage - Make sure you don't miss anything.

Only available from project root

  • npm run docker:build - Prepare for 'it works on my machine' solution.
  • npm run docker:run - 'it works on my machine' is no more.