Skip to content

Onboarding

davidabrahams edited this page Apr 15, 2019 · 6 revisions

Installation

  1. Install nvm to manage your node versions.
  2. Restart your bash session and install node using nvm: nvm install 10.15.3 (note, this is the node version we currently use in CI. Other versions are not guaranteed to be functional).
  3. In the root directory of this repo, install the node packages, including webpack: npm install

Testing the App

  • Run npm test. This will run all the unit tests.

Auto-linting your code

  • Run npm run lint:fix. This lint your code and perform any fixes that can be done automatically. It will then give a report of what you still need to fix.

Running the Code

  • Run npm run build. This will start webpack, which will "watch" the files in src/ and will update the bundle automatically. This will also run eslint whenever your code changes so you can see if the linter fails.
  • You can append :once to the previous command to run webpack without watching the files for changes.

Install Tampermonkey

To run the bot in tagpro, you must first install and setup Tampermonkey in your browser of choice. Go to https://tampermonkey.net/ for the download.

Setup Tampermonkey to Auto-Pull from a Local File

  • Allow Tampermonkey to have access to local files.
    • Google Chrome: edit your extension settings for Tampermonkey and check Allow access to file URLs.
    • Firefox: within Tampermonkey, go to settings, under General set Config mode to Advanced, then under Security set Allow scripts to access local files to Externals (@require and @resource).
  • Open your Tampermonkey Dashboard, create a new user script, and paste the following code:
// ==UserScript==
// @name          Chauncy-Crib TagproBot
// @description   A ball of paint AI
// @author        altodyte, billmwong, davidabrahams, shanek21
// @include       http://*.newcompte.fr:*
// @require       file:<PATH_TO_LOCAL_FILE>
// ==/UserScript==

For example,

// ==UserScript==
// @name          Chauncy-Crib TagproBot
// @description   A ball of paint AI
// @author        altodyte, billmwong, davidabrahams, shanek21
// @include       http://*.newcompte.fr:*
// @require       file:/home/skelly1/Documents/tpb/tagprobot/public/bundle.js
// ==/UserScript==

Hit save on your user script. Now every time you run the website indicated in the @include, Tampermonkey should read from your local specified file. Note: this will take ever so slightly longer than hard-coding a user script into the Tampermonkey editor, though I doubt this delay will cause any problems.