Files
platform/src/workspaces/emailer/src/templates.ts
T
2026-02-16 19:34:35 +00:00

18 lines
516 B
TypeScript

import path from 'node:path';
import { readdir, stat } from 'node:fs/promises';
export const templates: any = {};
const templateDir = path.resolve(__dirname, '..', 'emails');
const files = await readdir(templateDir);
for (let file of files) {
const fpath = path.join(templateDir, file);
const [name, ext] = file.split('.');
const fsStat = await stat(fpath);
if (!fsStat.isDirectory() && ext === 'tsx' && name) {
const { default: template } = await import(fpath);
templates[name] = template;
}
}