Merge commit 'a11f0b4e920fa92424d922ef3bfd68aba6b83e99'
This commit is contained in:
@@ -24,4 +24,20 @@ export function generateReportTemplate(title: string, data: Record<string, strin
|
||||
...Object.entries(data).map(([key, value]) => `- ${key}: ${value}`),
|
||||
];
|
||||
return lines.join('\n');
|
||||
import fs from "fs";
|
||||
import Handlebars from "handlebars";
|
||||
|
||||
export function renderTemplate(templatePath: string): string {
|
||||
const source = fs.readFileSync(templatePath, "utf8");
|
||||
const template = Handlebars.compile(source);
|
||||
return template({ period: "2025-11", month: "2025-11" });
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
const file = process.argv[2];
|
||||
if (!file) {
|
||||
throw new Error("Template path required");
|
||||
}
|
||||
const output = renderTemplate(file);
|
||||
process.stdout.write(output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user