Files
Komediruzecki e4ccd765c9 feat(mail): a script that mails a sample of every mail to one inbox
worker/scripts/send-sample-mails.ts renders every mail from
mail-samples.ts and sends each to the address given with --to, through
Resend's REST API. It refuses to run without --to, reads RESEND_API_KEY and
EMAIL_FROM from the environment under the Worker's names, and prints one
line per sample: its name and Resend's message id, or the error.
--dry-run <folder> writes each mail as .html and .txt instead of sending.

It runs under plain Node, which strips the types; scripts/node.d.ts
declares the few Node APIs it uses, since the worker has no @types/node.
2026-10-11 17:30:25 +02:00

23 lines
706 B
TypeScript

/**
* The few Node APIs the scripts here use. The worker has no @types/node: it would put Node's
* globals into the Worker's own types, where they do not exist. `process` is declared already, as
* `any`, by @cloudflare/workers-types.
*/
declare module 'node:fs/promises' {
export function mkdir(path: string, options: { recursive: true }): Promise<string | undefined>;
export function writeFile(path: string, data: string): Promise<void>;
}
declare module 'node:path' {
export function join(...paths: string[]): string;
}
declare module 'node:url' {
export function pathToFileURL(path: string): URL;
}
/** Node sets it on every ES module. */
interface ImportMeta {
readonly url: string;
}