Skip to content

Latest commit

 

History

History
134 lines (81 loc) · 3.95 KB

CONTRIBUTING.md

File metadata and controls

134 lines (81 loc) · 3.95 KB

Contributing

Development Setup

Alternative Environments

If you would prefer to use a prefabricated, "just works" environment, we provide a Docker DevContainer for your convenience.

Pre-requirements

  • Node.js version 16+ (for nvm users, just run nvm use)
  • Yarn

Steps

  1. Clone the repo:

    git clone https://github.com/shitcorp/wikipedia-bot-canary.git
  2. Install dependencies:

    yarn install
  3. Configuration: Make a copy of the file .env.example, name it .env, and fill in the values left blank.

  4. Ngrok Setup: If you have an ngrok account, run export NGROK_TOKEN=<yourToken>. Then run yarn ngrok to start a new tunnel. The tunnel url will be printed to console.

    (!) If your server is not running on port 8020, run export PORT=<your port>

  5. Services Setup: To start developing we need a few services set up. ZooKeeper and Redis to be precise. In order to get these 2 services running we provided a docker-compose file that lives in the root of this repository, so its just a matter of running docker-compose up -d.

  6. Watch code for changes:

    Linux & Mac OS

    yarn dev

    Windows

    yarn dev:windows

Tools

Main tools that used in this project:

Contributing Guidelines

  • Make a new branch for your changes, and name it aptly for your changes
  • Be sure to test your changes thoroughly
  • Follow the pull request template when submitting

Scripts

yarn start

The start command runs the compiled javascript from the dist directory.

yarn dev

The dev command runs both the watch and pc commands. It pipes the output of watch into pc.

yarn watch

The watch command runs nodemon to watch for changes to the typescript files, and then rebuild the project on the fly.

yarn ngrok

The ngrok command starts a new tunnel to ngrok.io so you can do your local developemt without having to own a webserver. Run

export NGROK_TOKEN=yourNgrokToken

first in order for the script to know your ngrok token (mandatory).

To point the ngrok tunnel to a custom port, set the environmental varibale PORT.

export PORT=<your port>

yarn pc

The pc command runs pino-colada whichs formats the logs outputed to the console.

yarn build

The build command compiles the typescript code into javascript.

yarn lint

The lint command use eslint and prettier to check for code or style issues.

yarn lint:fix

The lint:fix command uses eslint and prettier to automatically fix some code or style issues.

yarn contributors:*

yarn contributors:add, yarn contributors:check, yarn contributors:generate

The contributors: prefix indicates the command is for All Contributors.

The add suffix is for adding new contributors to the list of contributors.

The check suffix is for checking that all contributors listed by Github are given proper credit.

The generate suffix is for generating the list of contributors in the README.md file.

yarn zk:*

yarn zk:init, yarn zk:start, yarn zk:stop

The zookeeper: prefix indicates the command is for zookeeper.

The init suffix is for setting up the environment for zookeeper.

The start suffix is for starting zookeeper.

The stop suffix is for stopping zookeeper.