commander-practice 0.0.1 → 0.0.2
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 +3 -0
- package/index.d.ts +1 -1
- package/index.js +2 -6
- package/mailer/mailer.d.ts +1 -0
- package/mailer/mailer.js +73 -0
- package/package.json +7 -5
package/README.md
ADDED
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
package/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function add(x, y) {
|
|
6
|
-
return x + y;
|
|
7
|
-
}
|
|
8
|
-
exports.add = add;
|
|
3
|
+
const mailer_1 = require("./mailer/mailer");
|
|
4
|
+
(0, mailer_1.notify)();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function notify(): Promise<void>;
|
package/mailer/mailer.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.notify = void 0;
|
|
36
|
+
const nodemailer = __importStar(require("nodemailer"));
|
|
37
|
+
function notify() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const mailOption = {
|
|
40
|
+
from: 'frontend@cptgroup.cn',
|
|
41
|
+
to: 'xuxiaozhong@cptgroup.cn',
|
|
42
|
+
subject: '邮件发送测试',
|
|
43
|
+
text: '邮件发送测试,请勿回复!!',
|
|
44
|
+
html: `
|
|
45
|
+
<h1>发送测试</h1>
|
|
46
|
+
<p>
|
|
47
|
+
邮件发送测试,请勿回复!!
|
|
48
|
+
</p>
|
|
49
|
+
`
|
|
50
|
+
};
|
|
51
|
+
// Generate test SMTP service account from ethereal.email
|
|
52
|
+
// Only needed if you don't have a real mail account for testing
|
|
53
|
+
// const testAccount = await nodemailer.createTestAccount();
|
|
54
|
+
// create reusable transporter object using the default SMTP transport
|
|
55
|
+
const transporter = nodemailer.createTransport({
|
|
56
|
+
host: 'smtphz.qiye.163.com',
|
|
57
|
+
port: 465,
|
|
58
|
+
secure: true,
|
|
59
|
+
auth: {
|
|
60
|
+
user: 'frontend@cptgroup.cn',
|
|
61
|
+
pass: 'IcPt1357' // generated ethereal password
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// send mail with defined transport object
|
|
65
|
+
const info = yield transporter.sendMail(mailOption);
|
|
66
|
+
console.log(`邮件发送成功:${info.messageId}`);
|
|
67
|
+
// Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>
|
|
68
|
+
// Preview only available when sending through an Ethereal account
|
|
69
|
+
// console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
|
|
70
|
+
// Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.notify = notify;
|
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commander-practice",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"start": "ts-node index.ts ",
|
|
8
|
-
"build":"tsc && cp package.json ./dist",
|
|
9
|
-
"publish": "npm run build && npm publish
|
|
7
|
+
"start": "ts-node src/index.ts ",
|
|
8
|
+
"build": "rm -rf dist && tsc && cp package.json README.md ./dist",
|
|
9
|
+
"publish": "npm run build && cd ./dist && npm version patch && npm publish",
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [],
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"devDependencies": {
|
|
16
|
+
"@types/nodemailer": "^6.4.7",
|
|
16
17
|
"ts-node": "^10.9.1",
|
|
17
18
|
"typescript": "^4.9.4"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"commander": "^9.4.1"
|
|
21
|
+
"commander": "^9.4.1",
|
|
22
|
+
"nodemailer": "^6.8.0"
|
|
21
23
|
}
|
|
22
24
|
}
|