commander-practice 0.0.3 → 0.0.4

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/index.js CHANGED
@@ -1,4 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const mailer_1 = require("./mailer/mailer");
4
- (0, mailer_1.notify)();
3
+ const commander_1 = require("commander");
4
+ const program = new commander_1.Command();
5
+ program.name('rh-utils')
6
+ .description('RuiHui Utils')
7
+ .version('0.0.3');
8
+ program.command('clone <source> [destination]')
9
+ .description('clone string')
10
+ .option('-d,--depth <level>', 'set first option')
11
+ .action((source, destination, options) => {
12
+ console.log(`start clone file from ${source} to ${destination} with depth ${options.depth}`);
13
+ });
14
+ program.parse(process.argv);
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "commander-practice",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "start": "ts-node src/index.ts ",
7
+ "start": "ts-node src/index.ts --first",
8
8
  "build": "rm -rf dist && npm version patch && tsc && cp package.json README.md ./dist",
9
9
  "release": "npm run build && cd ./dist && npm publish",
10
10
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1 +0,0 @@
1
- export declare function notify(): Promise<void>;
package/mailer/mailer.js DELETED
@@ -1,73 +0,0 @@
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;