If you would prefer to use a prefabricated, "just works" environment, we provide a Docker DevContainer for your convenience.
-
Clone the repo:
git clone https://github.com/shitcorp/wikipedia-bot-canary.git
-
Install dependencies:
yarn install
-
Configuration: Make a copy of the file
.env.example
, name it.env
, and fill in the values left blank. -
Ngrok Setup: If you have an ngrok account, run
export NGROK_TOKEN=<yourToken>
. Then runyarn 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>
-
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
. -
Watch code for changes:
Linux & Mac OS
yarn dev
Windows
yarn dev:windows
Main tools that used in this project:
-
TypeScript as the development language
-
Slash-Create as framework to interact with the discord API
-
ZooKeeper as distributed configmanager
-
Redis as caching solution
- 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
The start
command runs the compiled javascript from the dist
directory.
The dev
command runs both the watch
and pc
commands. It pipes the output of watch
into pc
.
The watch
command runs nodemon
to watch for changes to the typescript files, and then rebuild the project on the fly.
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>
The pc
command runs pino-colada
whichs formats the logs outputed to the console.
The build
command compiles the typescript code into javascript.
The lint
command use eslint and prettier to check for code or style issues.
The lint:fix
command uses eslint and prettier to automatically fix some
code or style issues.
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.
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.