mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
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.
23 lines
706 B
TypeScript
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;
|
|
}
|