befly 3.4.9 → 3.4.11
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/bin/launcher.ts +6 -2
- package/commands/dev.ts +8 -1
- package/commands/start.ts +8 -1
- package/package.json +2 -2
package/bin/launcher.ts
CHANGED
|
@@ -101,9 +101,13 @@ export async function launch(entryFile: string): Promise<void> {
|
|
|
101
101
|
cwd: process.cwd(),
|
|
102
102
|
stdio: ['inherit', 'inherit', 'inherit'],
|
|
103
103
|
env: {
|
|
104
|
-
|
|
104
|
+
// 不继承父进程的环境变量,只使用以下变量
|
|
105
105
|
BEFLY_SUBPROCESS: '1', // 标记为子进程
|
|
106
|
-
NODE_ENV: envName //
|
|
106
|
+
NODE_ENV: envName, // 设置 NODE_ENV
|
|
107
|
+
PATH: process.env.PATH, // 保留 PATH
|
|
108
|
+
SYSTEMROOT: process.env.SYSTEMROOT, // Windows 需要
|
|
109
|
+
TEMP: process.env.TEMP, // Windows 需要
|
|
110
|
+
TMP: process.env.TMP // Windows 需要
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
|
package/commands/dev.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { join } from 'pathe';
|
|
6
|
-
import { existsSync } from 'node:fs';
|
|
6
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
7
7
|
import { Logger } from '../lib/logger.js';
|
|
8
8
|
import { Befly } from '../main.js';
|
|
9
9
|
import { getProjectRoot } from './util.js';
|
|
@@ -26,6 +26,13 @@ export async function devCommand(options: DevOptions) {
|
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// 检查并创建 logs 目录
|
|
30
|
+
const logsDir = join(projectRoot, 'logs');
|
|
31
|
+
if (!existsSync(logsDir)) {
|
|
32
|
+
mkdirSync(logsDir, { recursive: true });
|
|
33
|
+
Logger.info('已创建 logs 目录');
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
// 设置环境变量
|
|
30
37
|
process.env.NODE_ENV = 'development';
|
|
31
38
|
process.env.APP_PORT = options.port;
|
package/commands/start.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { join } from 'pathe';
|
|
6
|
-
import { existsSync } from 'node:fs';
|
|
6
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
7
7
|
import { Logger } from '../lib/logger.js';
|
|
8
8
|
import { ClusterManager } from '../lifecycle/cluster.js';
|
|
9
9
|
import { Befly } from '../main.js';
|
|
@@ -26,6 +26,13 @@ export async function startCommand(options: StartOptions) {
|
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// 检查并创建 logs 目录
|
|
30
|
+
const logsDir = join(projectRoot, 'logs');
|
|
31
|
+
if (!existsSync(logsDir)) {
|
|
32
|
+
mkdirSync(logsDir, { recursive: true });
|
|
33
|
+
Logger.info('已创建 logs 目录');
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
// 设置生产环境变量
|
|
30
37
|
process.env.NODE_ENV = 'production';
|
|
31
38
|
process.env.APP_PORT = options.port;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.11",
|
|
4
4
|
"description": "Befly - 为 Bun 专属打造的 TypeScript API 接口框架核心引擎",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"ora": "^9.0.0",
|
|
82
82
|
"pathe": "^2.0.3"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "d7a5eef1df6a0b46ce3202839d4deb91ac3276f9"
|
|
85
85
|
}
|