fix(email): document post-queue render path and tighten guard

This commit is contained in:
2026-06-27 00:15:21 +02:00
parent 0d8a7d29ed
commit 53010830f7
4 changed files with 23 additions and 15 deletions
+11 -4
View File
@@ -9,13 +9,20 @@ const files = fs.readdirSync(dir).filter((f) => f.endsWith('.html'));
const failures = [];
for (const f of files) {
const src = fs.readFileSync(path.join(dir, f), 'utf8');
const trimmed = src.trim();
const checks = [
[/IMPORT emails\/partials\/header\.(html|tpl)/, 'missing header IMPORT'],
[/IMPORT emails\/partials\/footer\.(html|tpl)/, 'missing footer IMPORT'],
[
trimmed.startsWith('<!-- IMPORT emails/partials/header.html -->'),
'header IMPORT must be first',
],
[
trimmed.endsWith('<!-- IMPORT emails/partials/footer.html -->'),
'footer IMPORT must be last',
],
[/<!-- preheader -->/, 'missing preheader marker'],
];
for (const [re, msg] of checks) {
if (!re.test(src)) failures.push(`${f}: ${msg}`);
for (const [check, msg] of checks) {
if (check instanceof RegExp ? !check.test(src) : !check) failures.push(`${f}: ${msg}`);
}
}