plac-micro-common 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,14 +44,16 @@ function getAssetsRootPath() {
44
44
  }
45
45
  function getFontBase64() {
46
46
  if (!cached_font_base64) {
47
- const font_path = path.join(getAssetsRootPath(), "fonts", "KhmerOS.ttf");
47
+ const assets_root = getAssetsRootPath();
48
+ const font_path = path.join(assets_root, "fonts", "KhmerOS.ttf");
48
49
  if (!fs.existsSync(font_path)) {
49
- throw new Error(`Khmer font not found at path: ${font_path}`);
50
+ throw new Error([
51
+ "[generateFormSIO] Font not found",
52
+ `__dirname: ${__dirname}`,
53
+ `assets_root: ${assets_root}`,
54
+ `font_path: ${font_path}`,
55
+ ].join("\n"));
50
56
  }
51
- console.log("[generateFormSIO] __dirname =", __dirname);
52
- console.log("[generateFormSIO] assets_root =", getAssetsRootPath());
53
- console.log("[generateFormSIO] font_path =", font_path);
54
- console.log("[generateFormSIO] font exists =", fs.existsSync(font_path));
55
57
  const font_buffer = fs.readFileSync(font_path);
56
58
  cached_font_base64 = font_buffer.toString("base64");
57
59
  }
@@ -59,16 +61,19 @@ function getFontBase64() {
59
61
  }
60
62
  function getTemplate(lang) {
61
63
  if (!cached_templates[lang]) {
64
+ const assets_root = getAssetsRootPath();
62
65
  const template_path = lang === "en"
63
- ? path.join(getAssetsRootPath(), "templates", "sio-form-en.ejs")
64
- : path.join(getAssetsRootPath(), "templates", "sio-form-kh.ejs");
66
+ ? path.join(assets_root, "templates", "sio-form-en.ejs")
67
+ : path.join(assets_root, "templates", "sio-form-kh.ejs");
65
68
  if (!fs.existsSync(template_path)) {
66
- throw new Error(`SIO template not found at path: ${template_path}`);
69
+ throw new Error([
70
+ "[generateFormSIO] Template not found",
71
+ `lang: ${lang}`,
72
+ `__dirname: ${__dirname}`,
73
+ `assets_root: ${assets_root}`,
74
+ `template_path: ${template_path}`,
75
+ ].join("\n"));
67
76
  }
68
- console.log("[generateFormSIO] __dirname =", __dirname);
69
- console.log("[generateFormSIO] assets_root =", getAssetsRootPath());
70
- console.log("[generateFormSIO] template_path =", template_path);
71
- console.log("[generateFormSIO] template exists =", fs.existsSync(template_path));
72
77
  const template = fs.readFileSync(template_path, "utf8");
73
78
  cached_templates[lang] = ejs.compile(template);
74
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plac-micro-common",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {