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 --unstableDocumentation
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:
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.watch- This can be left out, and if so, crumpet will not watch your client side TS files. Ifwatch.enableis set to true andwatch.directoryToWatchis 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.