befly-tpl 3.4.14 → 3.4.16

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/.env.development CHANGED
@@ -28,7 +28,7 @@ LOG_MAX_SIZE=52428800 # 50MB
28
28
  # 时区
29
29
  TZ="Asia/Shanghai"
30
30
  # 跨域配置
31
- ALLOWED_ORIGIN="*"
31
+ ALLOWED_ORIGIN=""
32
32
  ALLOWED_METHODS="GET, POST, PUT, DELETE, OPTIONS"
33
33
  ALLOWED_HEADERS="Content-Type, Authorization, authorization, token"
34
34
  EXPOSE_HEADERS="Content-Range, X-Content-Range, Authorization, authorization, token"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly-tpl",
3
- "version": "3.4.14",
3
+ "version": "3.4.16",
4
4
  "description": "Befly 3.0 TypeScript Template",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -10,8 +10,7 @@
10
10
  "scripts": {
11
11
  "dev": "bun run --env-file=.env.development main.ts",
12
12
  "start": "bun run --env-file=.env.production main.ts",
13
- "pm2:start": "pm2 start pm2.config.js --env production",
14
- "pm2:dev": "pm2 start pm2.config.js --env development",
13
+ "pm2": "pm2 start pm2.config.cjs",
15
14
  "sync:dev": "NODE_ENV=development befly sync",
16
15
  "sync:prod": "NODE_ENV=production befly sync"
17
16
  },
@@ -32,10 +31,10 @@
32
31
  ],
33
32
  "type": "module",
34
33
  "dependencies": {
35
- "befly": "^3.4.13"
34
+ "befly": "^3.4.15"
36
35
  },
37
36
  "engines": {
38
37
  "bun": ">=1.3.0"
39
38
  },
40
- "gitHead": "f37b14e9acad47245d399709829013fda8a0c44e"
39
+ "gitHead": "f7fad19e6c07b776a4a3c1aa83d09497ababb719"
41
40
  }
package/pm2.config.cjs ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * PM2 进程管理配置文件(CommonJS 格式)
3
+ * 使用 Bun 运行 TypeScript 文件
4
+ *
5
+ * 使用方法:
6
+ * 1. 启动:pm2 start pm2.config.cjs
7
+ * 2. 查看状态:pm2 status
8
+ * 3. 查看日志:pm2 logs befly
9
+ * 4. 重启:pm2 restart befly
10
+ * 5. 停止:pm2 stop befly
11
+ * 6. 删除:pm2 delete befly
12
+ * 7. 保存配置:pm2 save
13
+ * 8. 开机自启:pm2 startup
14
+ *
15
+ * 环境变量加载:
16
+ * - 默认使用生产环境:--env-file=.env.production
17
+ *
18
+ * 注意:PM2 配置文件必须使用 CommonJS 格式(.cjs),不支持 ESM
19
+ */
20
+
21
+ module.exports = {
22
+ apps: [
23
+ {
24
+ name: 'befly',
25
+ script: 'bun',
26
+ args: 'run --env-file=.env.production main.ts',
27
+
28
+ // 集群模式配置
29
+ instances: 4, // 实例数量,可设置为 'max' 使用所有 CPU
30
+ exec_mode: 'cluster', // 集群模式
31
+
32
+ // 自动重启配置
33
+ autorestart: true,
34
+ watch: false,
35
+ max_memory_restart: '1G', // 内存超过 1G 自动重启
36
+
37
+ // 日志配置
38
+ error_file: './logs/pm2-error.log',
39
+ out_file: './logs/pm2-out.log',
40
+ log_date_format: 'YYYY-MM-DD HH:mm:ss',
41
+ merge_logs: true
42
+ }
43
+ ]
44
+ };