0.1.0-testing.js.multiplatform • Published 8 months ago

@monitio/boot v0.1.0-testing.js.multiplatform

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
8 months ago

boot

An ESM-first, Node-free framework for building bots of multiple different kind.



Features

Usage

We recommend using esm.sh instead of NPM because not all environments have NodeJS and NPM installed. We only put it in an NPM package so that esm.sh recognizes this as an existing thing. But if you want to still use NPM in a NodeJS capable environment for this framework because your used to using it already, go ahead.

Adapters

  • GitHub (webhooks, REST API)
  • Discord (coming soon)

Examples of usage:

Github adapter:

import {
  BootBot,
  GitHubAdapter,
  autoHandler
} from "https://esm.sh/@monitio/boot";

const bot = new BootBot();
bot.use(GitHubAdapter({ secret: "..." }));

bot.on("github:push", (payload) => {
  console.log("Push event:", payload);
});

// Export the right handler depending on environment
export default autoHandler(bot);

Testing

To test we are using NodeJS and Vitest but in actual scenarios you do not actually need NodeJS or Vitest to run. There is a Github Actions called CI that runs every single time a commit is pushed to Github, or a pull request is made that tests for you. So no need to check your code first if you are contributing but it would be helpful if you did.

To test you run the command: npm test And that will run Vitest which will run all of the tests.