Skip to content

Commit

Permalink
fix: update handlebars helperized es module now and fix for file impo…
Browse files Browse the repository at this point in the history
…rt issue
  • Loading branch information
Arun-KumarH committed Apr 23, 2024
1 parent ee7f16b commit 704e27b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@restorecommerce/chassis-srv": "^1.6.0",
"@restorecommerce/cluster-service": "^1.0.3",
"@restorecommerce/grpc-client": "^2.2.1",
"@restorecommerce/handlebars-helperized": "^1.0.11",
"@restorecommerce/handlebars-helperized": "^1.3.0",
"@restorecommerce/kafka-client": "^1.2.1",
"@restorecommerce/logger": "^1.2.10",
"@restorecommerce/service-config": "^1.0.12",
Expand Down
7 changes: 5 additions & 2 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ export class Service {
// read all file names from the handlebars folder
let absolutePath: string;
for (let file of fs.readdirSync(HANDLEBARS_DIR)) {
absolutePath = CURR_DIR + REL_PATH_HANDLEBARS + file;
customHelpersList.push(absolutePath);
if (file.endsWith('.cjs')) {
absolutePath = CURR_DIR + REL_PATH_HANDLEBARS + file;
customHelpersList.push(absolutePath);
}
}

await this.subscribeTopics();
Expand Down Expand Up @@ -209,6 +211,7 @@ export class Service {
}
let rendered;
try {
await tplRenderer?.waitLoad();
rendered = tplRenderer.render(data); // rendered HTML string
} catch (err) {
this.logger.error('Error while rendering template:', template);
Expand Down

0 comments on commit 704e27b

Please sign in to comment.