update-flake-lock/src/template.ts

23 lines
545 B
TypeScript
Raw Normal View History

import Handlebars from "handlebars";
2024-06-04 17:44:31 +02:00
export function renderPullRequestBody(template: string): string {
const tpl = Handlebars.compile(template);
return tpl({});
}
export function renderCommitMessage(
template: string,
2024-06-04 17:44:31 +02:00
flakeDotLockDir: string,
flakeDotLock: string,
): string {
2024-06-04 17:44:31 +02:00
return render(template, {
flake_dot_lock_dir: flakeDotLockDir,
flake_dot_lock: flakeDotLock,
});
}
function render(template: string, inputs: Record<string, string>): string {
const tpl = Handlebars.compile(template);
return tpl(inputs);
}