befly-tpl 3.11.17 → 3.11.19

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 CHANGED
@@ -28,9 +28,6 @@ mkdir my-api && cd my-api
28
28
 
29
29
  # 安装 Befly
30
30
  bun add befly
31
-
32
- # 初始化项目(即将支持)
33
- bunx befly init
34
31
  ```
35
32
 
36
33
  ### 最简示例
@@ -39,11 +36,8 @@ bunx befly init
39
36
  // main.ts
40
37
  import { Befly } from "befly";
41
38
 
42
- const app = new Befly({
43
- appName: "My API",
44
- appPort: 3000
45
- });
46
-
39
+ // 配置从 configs/befly.*.json 扫描加载(见 packages/core/befly.config.ts)
40
+ const app = new Befly();
47
41
  await app.start();
48
42
  ```
49
43
 
@@ -74,7 +68,13 @@ export default {
74
68
  } as ApiRoute;
75
69
  ```
76
70
 
77
- 访问:`http://localhost:3000/api/user/hello`
71
+ 访问:`http://localhost:3000/api/app/user/hello`
72
+
73
+ ### 最小 smoke:在 tpl 项目新增接口并访问
74
+
75
+ 1. 新增文件:`apis/user/hello.ts`(上面示例可直接使用)
76
+ 2. 启动服务:`bun run dev`
77
+ 3. 访问:`http://localhost:3000/api/app/user/hello`
78
78
 
79
79
  ## 🔥 新版本特性(3.0)
80
80
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "befly-tpl",
3
- "version": "3.11.17",
4
- "gitHead": "f3285b9ba4e510e6e903fbf800c96480d56ce36b",
3
+ "version": "3.11.19",
4
+ "gitHead": "0914e9a6efb3f41136034f14d5f9cda4d5e7c3d0",
5
5
  "private": false,
6
6
  "description": "Befly 3.0 TypeScript Template",
7
7
  "files": [
@@ -25,12 +25,13 @@
25
25
  "scripts": {
26
26
  "dev": "NODE_ENV=development bun run main.ts",
27
27
  "start": "NODE_ENV=production bun run main.ts",
28
- "pm2": "bun --bun pm2 start pm2.config.cjs",
28
+ "serve": "bunx --bun pm2 start pm2.config.cjs",
29
+ "typecheck": "bunx tsgo -p tsconfig.json --noEmit",
29
30
  "test": "bun test"
30
31
  },
31
32
  "dependencies": {
32
- "@befly-addon/admin": "^1.2.16",
33
- "befly": "^3.10.17"
33
+ "@befly-addon/admin": "^1.2.18",
34
+ "befly": "^3.10.19"
34
35
  },
35
36
  "engines": {
36
37
  "bun": ">=1.3.0"
package/pm2.config.cjs CHANGED
@@ -6,7 +6,7 @@ module.exports = {
6
6
  interpreter: "bun",
7
7
 
8
8
  // 集群模式配置
9
- instances: 2, // 实例数量,可设置为 'max' 使用所有 CPU
9
+ instances: 1, // 实例数量,可设置为 'max' 使用所有 CPU
10
10
  exec_mode: "cluster", // 集群模式
11
11
 
12
12
  // 自动重启配置
package/tsconfig.json CHANGED
@@ -1,23 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "target": "ESNext",
5
- "module": "ESNext",
6
- "lib": ["ESNext"],
7
- "moduleResolution": "bundler",
8
- "allowImportingTsExtensions": true,
9
- "noEmit": true,
10
- "strict": true,
11
- "skipLibCheck": true,
12
- "types": ["bun"],
13
- "baseUrl": ".",
14
- "paths": {
15
- "befly": ["../core/main.ts"],
16
- "befly/*": ["../core/*"]
17
- },
18
- "resolveJsonModule": true,
19
- "esModuleInterop": true,
20
- "forceConsistentCasingInFileNames": true
4
+ "types": ["bun"]
21
5
  },
22
6
  "include": ["**/*.ts", "**/*.d.ts"],
23
7
  "exclude": ["node_modules", "data", "logs", "tests"]