From 29d6adee387d8d3af2ac5b8a77111958eb1bda6b Mon Sep 17 00:00:00 2001 From: Luke Fritz Date: Sat, 13 Apr 2024 22:09:32 -0500 Subject: [PATCH] Change promise mechanism in writerOpts (patch) --- src/writer.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/writer.js b/src/writer.js index 3f2e61b..8e86746 100644 --- a/src/writer.js +++ b/src/writer.js @@ -58,9 +58,17 @@ function getWriterOpts() { } export async function createWriterOpts() { + const [ template, header, commit ] = await Promise.all([ + readFile(resolve(dirname, './templates/template.hbs'), 'utf-8'), + readFile(resolve(dirname, './templates/header.hbs'), 'utf-8'), + readFile(resolve(dirname, './templates/commit.hbs'), 'utf-8'), + ]); + const writerOpts = getWriterOpts(); - writerOpts.mainTemplate = await readFile(resolve(dirname, './templates/template.hbs'), 'utf-8'); - writerOpts.headerPartial = await readFile(resolve(dirname, './templates/header.hbs'), 'utf-8'); - writerOpts.commitPartial = await readFile(resolve(dirname, './templates/commit.hbs'), 'utf-8'); + + writerOpts.mainTemplate = template; + writerOpts.headerPartial = header; + writerOpts.commitPartial = commit; + return writerOpts; }