Skip to main content
Deno 2 is finally here 🎉️
Learn more

Crumpets


Contents

Quick Start

import { crumpet } from "https://deno.land/x/crumpet@v1.0.0/mod.ts";
await crumpet({
  rootFile: Deno.cwd() + "/public/pagejs/index.ts",
  watch: {
    enable: true,
    directoryToWatch: "./public/pagejs",
  },
});
$ deno run --allow-read=. --allow-write=public/pagejs --unstable

Documentation

Crumpet is used to transpile all your client side typescript code. It will place the transpiles javascript code beside it’s typescript counterpart.

You will need to create a single entrypoint, that imports all of your files, for example:

your-project/
  public/
    js/
      index.ts
      users/
        new.ts
        edit.ts
      home.ts
// public/js/index.ts
import "./home.ts";
import "./users/new.ts";
import "./users/edit.ts";

crumpet(configs: IConfigs): Promise<void>

IConfigs contain the following properties:

  1. rootFile - This is the file that imports every client file you expect to use. Note that this is required, becausing emitting only this file (whilst still generating the transpiled code for all the imported files), has a huge performance improvement over iterating over every file and emitting them.

  2. watch - This can be left out, and if so, crumpet will not watch your client side TS files. If watch.enable is set to true and watch.directoryToWatch is set to a directory, crumpet will first transpile your file, then watch for any file changes on your TS file, re-transpiling that specific file when modified.