Skip to main content

Motor

This is a starter template for building Deno packages in TypeScript, with GitHub Actions-powered CI, tests, CLI, and Semantic Release on GitHub and npm.

Deno CI GitHub Contributors Deno Starter Made by Denorg TypeScript semantic-release

🔑 Start the motor

import { motor } from "https://deno.land/x/motor@0.0/mod.ts";

type Gears = Keys<"stopped" | "paused" | "playing" | "loading">;

type Events = Keys<"SELECT" | "LOAD" | "PLAY" | "PAUSE" | "STOP">;

const musicPlayer: MotorSpec<Gears, Events> = {
  gear: "stopped",
  transmission: {
    stopped: {
      on: { LOAD: "loading" },
    },
    paused: {
      on: { PLAY: "playing", STOP: "stopped" },
    },
    loading: {
      on: { PLAY: "playing", STOP: "stopped" },
    },
    playing: {
      on: { PAUSE: "paused", STOP: "stopped" },
    },
  },
};

CLI with DPX

After installing DPX, you can directly use the CLI using the dpx command:

dpx --allow-read starter <arguments>

CLI

Alternatively, you can use it directly from the CLI by using deno run:

deno run --allow-read https://raw.githubusercontent.com/sidiousvic/motor/master/cli.ts <arguments>

You can also install it globally using the following:

deno install --allow-read -n starter https://raw.githubusercontent.com/sidiousvic/motor/master/cli.ts

Then, the package is available to run:

starter <arguments>

Configuration

Required permissions:

  1. --allow-read

👩‍💻 Development

Run tests:

deno test --allow-read

📄 License

MIT