@flun/mailer 2.1.21 → 2.1.23

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/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # 变更日志
2
+ ## [2.1.23] - 2026-09-29 19:29
3
+ ### 更改
4
+ - 加固了拷贝文件的一些逻辑;
5
+ - 升级了依赖;
6
+
7
+ ## [2.1.22] - 2026-07-22 21:48
8
+ ### 优化:
9
+ - 对 'README.md' 中一些描述做了一些优化;
10
+
2
11
  ## [2.1.21] - 2026-07-06 16:20
3
12
  ### 优化:
4
- - README 中“配置”章节细节优化;
5
- ## [2.1.20] - 2026-07-06 15:53
6
- ### 新增
7
- - 在 README 中新增“配置”章节,指导用户通过 `allowScripts` 显式放行本包的安装脚本,避免因 `ignore-scripts` 全局配置导致钩子被跳过。
13
+ - README 中“配置”章节细节优化;
package/README.md CHANGED
@@ -37,7 +37,7 @@ graph TD
37
37
  }
38
38
  ```
39
39
 
40
- > 如果你信任所有安装包,也可以直接在项目 `.npmrc` 中设置 `allow-scripts = false`(表示关闭脚本拦截,所有脚本均允许执行),或删除/设为 `ignore-scripts = false`;
40
+ > 如果你信任所有安装包,也可以直接在项目 `.npmrc` 中设置 `allow-scripts = false`(表示关闭脚本拦截,所有脚本均允许执行),或删除 `ignore-scripts` 字段;
41
41
 
42
42
  ---
43
43
 
package/copy-files.js CHANGED
@@ -2,13 +2,10 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
 
5
- // 获取当前文件所在目录
5
+ // 要复制的文件位置和文件目标位置
6
6
  const __filename = fileURLToPath(import.meta.url), __dirname = path.dirname(__filename),
7
-
8
- // 要拷贝和写入的文件名和目标(项目根目录)
9
- fileName = 'Mail.js', targetDir = path.resolve(__dirname, '../../..'),
10
-
11
- // 源文件和目标文件路径
7
+ fileName = 'Mail.js', targetDir = path.resolve(process.env.INIT_CWD || process.cwd()),
8
+ // 要拷贝的源文件和目标文件路径
12
9
  sourceFile = path.join(__dirname, fileName), targetFile = path.join(targetDir, fileName);
13
10
 
14
11
  /**
@@ -19,7 +16,10 @@ const __filename = fileURLToPath(import.meta.url), __dirname = path.dirname(__fi
19
16
  const copyFile = () => {
20
17
  console.log(`🔍 检查 ${fileName} 文件...`), console.log(`📁 项目根目录:${targetDir}`);
21
18
  try {
22
- if (fs.existsSync(targetFile)) return true; // 如果目标文件存在,则返回true并结束函数
19
+ // 目标目录不是 Node 项目 || 包自身的 npm install(开发调试)→ 跳过
20
+ if (!fs.existsSync(path.join(targetDir, 'package.json'))) return true;
21
+ if (targetDir === path.resolve(__dirname, '..')) return true;
22
+ if (fs.existsSync(targetFile)) return true; // 目标文件已存在 → 直接返回
23
23
  console.log(`⚠️ 在项目根目录未找到 ${fileName} 文件,正在创建...`);
24
24
 
25
25
  fs.copyFileSync(sourceFile, targetFile); // 复制源文件到项目根目录
@@ -29,7 +29,7 @@ const copyFile = () => {
29
29
  console.error(`✗ 创建 ${fileName} 文件失败:`, error.message);
30
30
  return false;
31
31
  }
32
- }
32
+ };
33
33
 
34
34
  if (process.argv[1] === __filename) copyFile();
35
35
  export { copyFile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flun/mailer",
3
- "version": "2.1.21",
3
+ "version": "2.1.23",
4
4
  "description": "A powerful and flexible email sending library for Node.js with multiple transport support (SMTP, SMTP Pool, Sendmail, Stream, JSON, SES)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -53,14 +53,14 @@
53
53
  "npm": ">=10.0.0"
54
54
  },
55
55
  "dependencies": {
56
- "@aws-sdk/client-sesv2": "^3.1072.0"
56
+ "@aws-sdk/client-sesv2": "^3.1142.0"
57
57
  },
58
58
  "devDependencies": {
59
- "eslint": "^10.5.0",
60
- "jest": "^30.4.2"
59
+ "eslint": "^10.11.0",
60
+ "jest": "^30.5.2"
61
61
  },
62
62
  "peerDependencies": {
63
- "node": ">=16.0.0"
63
+ "node": ">=22.23.3"
64
64
  },
65
65
  "directories": {
66
66
  "lib": "lib",
@@ -69,7 +69,6 @@
69
69
  },
70
70
  "scripts": {
71
71
  "postinstall": "node copy-files.js 2>&1",
72
- "test": "echo \"Error: no test specified\" && exit 1",
73
72
  "start": "node index.js",
74
73
  "dev": "node --watch index.js",
75
74
  "lint": "eslint .",