@mysetup/nodemailer 2.0.0 → 2.0.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.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @mysetup/nodemailer
2
+
3
+ Email utility package that wraps `nodemailer` with EJS template rendering.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @mysetup/nodemailer
9
+ ```
10
+
11
+ ## Supported libraries and runtimes
12
+
13
+ | Supported | Notes |
14
+ | ---------------------- | ------------- |
15
+ | Node.js | Full support |
16
+ | Next.js server runtime | Supported |
17
+ | Browser apps | Not supported |
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ import { connectNodeMailer } from "@mysetup/nodemailer";
23
+
24
+ await connectNodeMailer(
25
+ {
26
+ subject: "Welcome",
27
+ toEmail: "user@example.com",
28
+ template: "Test",
29
+ value: { name: "Krishna" },
30
+ },
31
+ {
32
+ user: process.env.SMTP_USER || "",
33
+ pass: process.env.SMTP_PASS || "",
34
+ from: "no-reply@example.com",
35
+ },
36
+ );
37
+ ```
38
+
39
+ ## Notes
40
+
41
+ - Built for server-side use only.
42
+ - Template files are published into `dist/views` unless `htmlTemplate` is provided directly.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from "./nodemailer";
2
2
  export * from "./types";
3
- //# sourceMappingURL=index.d.ts.map
@@ -6,4 +6,3 @@ import { type SendEmailEnv, type SendEmailInput } from "./types";
6
6
  * @returns A promise that resolves to the result of the email sending operation.
7
7
  */
8
8
  export declare const connectNodeMailer: (data: SendEmailInput, config: SendEmailEnv) => Promise<string>;
9
- //# sourceMappingURL=nodemailer.d.ts.map
@@ -24,4 +24,3 @@ export interface SendEmailInput {
24
24
  raw?: string | Buffer | Readable;
25
25
  }[];
26
26
  }
27
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Test Email Service Checkup</title>
8
+ </head>
9
+
10
+ <body>
11
+ <h1>🚀 Service working</h1>
12
+ <p>From Email: <%= fromName %>
13
+ </p>
14
+ </body>
15
+
16
+ </html>
package/package.json CHANGED
@@ -1,50 +1,60 @@
1
1
  {
2
- "name": "@mysetup/nodemailer",
3
- "version": "2.0.0",
4
- "license": "MIT",
5
- "main": "dist/index.js",
6
- "files": [
7
- "dist"
8
- ],
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.js"
14
- },
15
- "./package.json": "./package.json"
2
+ "name": "@mysetup/nodemailer",
3
+ "version": "2.0.3",
4
+ "description": "Email helpers built on nodemailer with EJS template support.",
5
+ "author": "krishnaraj <krishnaraj.webdev@gmail.com>",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "nodemailer",
9
+ "email",
10
+ "ejs",
11
+ "nodejs",
12
+ "typescript"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.js"
16
28
  },
17
- "scripts": {
18
- "dev": "nodemon",
19
- "lint": "eslint .",
20
- "typecheck": "tsc --noEmit",
21
- "build": "rm -rf ./dist && tsc",
22
- "format": "prettier --write \"**/*.{ts,tsx,md,js}\"",
23
- "checks": "pnpm typecheck && pnpm lint",
24
- "clean": "rm -rf node_modules .swc dist pnpm-lock.yaml && echo \"✅ Successfully removed \""
25
- },
26
- "dependencies": {
27
- "ejs": "3.1.10",
28
- "nodemailer": "^6.10.0"
29
- },
30
- "devDependencies": {
31
- "@eslint/eslintrc": "^3.3.1",
32
- "@eslint/js": "^9.36.0",
33
- "@mysetup/eslint-config": "latest",
34
- "@mysetup/logger": "latest",
35
- "@mysetup/prettier-config": "latest",
36
- "@mysetup/tsconfig": "latest",
37
- "@types/ejs": "^3.1.5",
38
- "@types/node": "^22.13.1",
39
- "@types/nodemailer": "^6.4.17",
40
- "eslint": "9.32.0",
41
- "nodemon": "3.1.7",
42
- "ts-node": "^10.9.2",
43
- "typescript": "5.5.4"
44
- },
45
- "prettier": "@mysetup/prettier-config",
46
- "engines": {
47
- "node": ">=20.15.1"
48
- },
49
- "packageManager": "pnpm@9.9.0"
50
- }
29
+ "./package.json": "./package.json"
30
+ },
31
+ "dependencies": {
32
+ "ejs": "3.1.10",
33
+ "nodemailer": "^6.10.0",
34
+ "@mysetup/logger": "^2.0.4"
35
+ },
36
+ "devDependencies": {
37
+ "@types/ejs": "^3.1.5",
38
+ "@types/node": "^22.13.1",
39
+ "@types/nodemailer": "^6.4.17",
40
+ "nodemon": "3.1.7",
41
+ "ts-node": "^10.9.2",
42
+ "typescript": "5.5.4",
43
+ "@mysetup/prettier-config": "^2.0.4",
44
+ "@mysetup/eslint-config": "^2.0.5",
45
+ "@mysetup/tsconfig": "^2.0.4"
46
+ },
47
+ "prettier": "@mysetup/prettier-config",
48
+ "engines": {
49
+ "node": ">=20.15.1"
50
+ },
51
+ "scripts": {
52
+ "dev": "nodemon",
53
+ "lint": "node ../scripts/run-eslint.cjs .",
54
+ "typecheck": "tsc --noEmit",
55
+ "build": "node ../scripts/package-fs.cjs remove dist && tsc -p tsconfig.build.json && node ../scripts/package-fs.cjs copy-ext views dist/views .ejs",
56
+ "format": "prettier --write \"**/*.{ts,tsx,md,js}\"",
57
+ "checks": "pnpm typecheck && pnpm lint && pnpm build",
58
+ "clean": "node ../scripts/package-fs.cjs remove node_modules .swc dist pnpm-lock.yaml && echo \"Cleaned\""
59
+ }
60
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodemailer.d.ts","sourceRoot":"","sources":["../nodemailer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAgCjE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SACpB,cAAc,UACZ,YAAY,oBAqCvB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=test-nodemailer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-nodemailer.d.ts","sourceRoot":"","sources":["../../test/test-nodemailer.ts"],"names":[],"mappings":""}
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var _a, _b, _c;
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- var logger_1 = require("@mysetup/logger");
41
- var nodemailer_1 = require("../nodemailer");
42
- var config = {
43
- user: (_a = process.env.SMTP_EMAIL) !== null && _a !== void 0 ? _a : "",
44
- pass: (_b = process.env.SMTP_PASS) !== null && _b !== void 0 ? _b : "",
45
- from: (_c = process.env.SMTP_FROM) !== null && _c !== void 0 ? _c : "",
46
- };
47
- var data = {
48
- template: "test",
49
- value: { fromName: "krishnaraj" },
50
- toEmail: "krishna42cse@gmail.com",
51
- subject: "Test Email from Nodemailer + Nodemon",
52
- };
53
- function init() {
54
- return __awaiter(this, void 0, void 0, function () {
55
- var result, err_1;
56
- return __generator(this, function (_a) {
57
- switch (_a.label) {
58
- case 0:
59
- _a.trys.push([0, 2, , 3]);
60
- return [4 /*yield*/, (0, nodemailer_1.connectNodeMailer)(data, config)];
61
- case 1:
62
- result = _a.sent();
63
- logger_1.logger.info(result);
64
- return [3 /*break*/, 3];
65
- case 2:
66
- err_1 = _a.sent();
67
- logger_1.logger.error("Failed to send email:", err_1);
68
- return [3 /*break*/, 3];
69
- case 3: return [2 /*return*/];
70
- }
71
- });
72
- });
73
- }
74
- void init();
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE;QACV,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;QACrC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;KACpC,EAAE,CAAC;CACP"}