Skip to content

Commit

Permalink
Change promise mechanism in writerOpts (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukiffer committed Apr 14, 2024
1 parent 34150f8 commit 29d6ade
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 29d6ade

Please sign in to comment.