my-typescript-library-rahul52us 1.4.2 → 1.4.3

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.
@@ -18,8 +18,12 @@ const fs_1 = __importDefault(require("fs"));
18
18
  const path_1 = __importDefault(require("path"));
19
19
  function compileEmailTemplate({ fileName, data }) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
- const mjMail = yield fs_1.default.promises.readFile(path_1.default.join('src/email-templates', fileName), 'utf8');
21
+ const templatePath = path_1.default.resolve('src/email-templates', fileName);
22
+ // Read the MJML template
23
+ const mjMail = yield fs_1.default.promises.readFile(templatePath, 'utf8');
24
+ // Compile with Handlebars
22
25
  const template = handlebars_1.default.compile(mjMail)(data);
26
+ // Convert MJML to HTML
23
27
  return (0, mjml_1.default)(template).html.toString();
24
28
  });
25
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compile-email-template.js","sourceRoot":"","sources":["../../src/helpers/compile-email-template.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4DAAoC;AACpC,gDAA6B;AAC7B,4CAAoB;AACpB,gDAAwB;AAoBxB,SAA8B,oBAAoB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAS;;QAC1E,MAAM,MAAM,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QAC9F,MAAM,QAAQ,GAAG,oBAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAClD,OAAO,IAAA,cAAS,EAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;CAAA;AAJD,uCAIC"}
1
+ {"version":3,"file":"compile-email-template.js","sourceRoot":"","sources":["../../src/helpers/compile-email-template.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4DAAoC;AACpC,gDAA6B;AAC7B,4CAAoB;AACpB,gDAAwB;AAoBxB,SAA8B,oBAAoB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAS;;QAC1E,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;QAEnE,yBAAyB;QACzB,MAAM,MAAM,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEhE,0BAA0B;QAC1B,MAAM,QAAQ,GAAG,oBAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAElD,uBAAuB;QACvB,OAAO,IAAA,cAAS,EAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;CAAA;AAXD,uCAWC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-typescript-library-rahul52us",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "A reusable TypeScript utility library.",
5
5
  "main": "dist/server.js",
6
6
  "types": "dist/types/server.d.ts",
@@ -11,18 +11,25 @@ type Props = {
11
11
  url?: string;
12
12
  teamName?: string;
13
13
  link?: string;
14
- workflow_name?:string;
15
- password?:string;
16
- username?:string;
17
- level?:string;
18
- role?:string;
19
- designation?:string;
20
- verifyTokenUrl?:string
21
- }
14
+ workflow_name?: string;
15
+ password?: string;
16
+ username?: string;
17
+ level?: string;
18
+ role?: string;
19
+ designation?: string;
20
+ verifyTokenUrl?: string;
21
+ };
22
22
  };
23
23
 
24
24
  export default async function compileEmailTemplate({ fileName, data }: Props): Promise<string> {
25
- const mjMail = await fs.promises.readFile(path.join('src/email-templates', fileName), 'utf8');
25
+ const templatePath = path.resolve('src/email-templates', fileName);
26
+
27
+ // Read the MJML template
28
+ const mjMail = await fs.promises.readFile(templatePath, 'utf8');
29
+
30
+ // Compile with Handlebars
26
31
  const template = handlebars.compile(mjMail)(data);
32
+
33
+ // Convert MJML to HTML
27
34
  return mjml2html(template).html.toString();
28
35
  }