@mindbase/cli 1.0.8 → 1.0.9
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/dist/bin/mindbase.d.ts +1 -0
- package/dist/bin/mindbase.js +40 -0
- package/dist/bin/mindbase.js.map +1 -0
- package/dist/chunk-AAFO56WL.js +938 -0
- package/dist/chunk-AAFO56WL.js.map +1 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/package.json +7 -5
- package/src/bin/mindbase.ts +0 -39
- package/src/commands/init/backend.ts +0 -34
- package/src/commands/init/frontend.ts +0 -34
- package/src/commands/init/index.ts +0 -50
- package/src/commands/sdk-docs.ts +0 -138
- package/src/index.ts +0 -33
- package/src/utils/BackendInitializer.ts +0 -377
- package/src/utils/FrontendInitializer.ts +0 -370
- package/src/utils/Logger.ts +0 -219
- package/src/utils/prompts.ts +0 -140
- package/tsconfig.json +0 -15
package/src/utils/prompts.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
export interface BackendModule {
|
|
2
|
-
name: string;
|
|
3
|
-
required?: boolean;
|
|
4
|
-
description: string;
|
|
5
|
-
package: string;
|
|
6
|
-
dependencies?: string[];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 后端模块定义
|
|
11
|
-
*/
|
|
12
|
-
export const BACKEND_MODULES: BackendModule[] = [
|
|
13
|
-
{ name: "auth", required: true, description: "认证权限", package: "@mindbase/express-auth" },
|
|
14
|
-
{ name: "kv", description: "键值存储", package: "@mindbase/express-kv" },
|
|
15
|
-
{ name: "admin", dependencies: ["auth"], description: "用户管理", package: "@mindbase/express-admin" },
|
|
16
|
-
{ name: "storage", dependencies: ["auth", "kv"], description: "文件存储", package: "@mindbase/express-storage" },
|
|
17
|
-
{ name: "explorer", description: "文件管理", package: "@mindbase/express-explorer" },
|
|
18
|
-
{ name: "knowledge", dependencies: ["auth"], description: "知识库", package: "@mindbase/express-knowledge" },
|
|
19
|
-
{ name: "commandRunner", description: "命令管理", package: "@mindbase/express-command-runner" },
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 前端应用形态定义
|
|
24
|
-
*/
|
|
25
|
-
export interface FrontendAppType {
|
|
26
|
-
name: string;
|
|
27
|
-
description: string;
|
|
28
|
-
package: string;
|
|
29
|
-
available: boolean;
|
|
30
|
-
dependencies?: string[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const FRONTEND_APP_TYPES: FrontendAppType[] = [
|
|
34
|
-
{
|
|
35
|
-
name: "admin-app",
|
|
36
|
-
description: "管理后台 - 完整的管理界面",
|
|
37
|
-
package: "@mindbase/vue3-admin-app",
|
|
38
|
-
available: true,
|
|
39
|
-
dependencies: ["@mindbase/vue3-auth", "@mindbase/vue3-kv", "@mindbase/vue3-client"],
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 解析模块依赖关系
|
|
45
|
-
* @param selectedModules 用户选择的模块列表
|
|
46
|
-
* @returns 包含所有依赖的完整模块列表
|
|
47
|
-
*/
|
|
48
|
-
export function resolveDependencies(selectedModules: string[]): BackendModule[] {
|
|
49
|
-
const result = new Map<string, BackendModule>();
|
|
50
|
-
|
|
51
|
-
function addModule(name: string) {
|
|
52
|
-
if (result.has(name)) return;
|
|
53
|
-
|
|
54
|
-
const module = BACKEND_MODULES.find((m) => m.name === name);
|
|
55
|
-
if (!module) return;
|
|
56
|
-
|
|
57
|
-
// 先添加依赖
|
|
58
|
-
if (module.dependencies) {
|
|
59
|
-
for (const dep of module.dependencies) {
|
|
60
|
-
addModule(dep);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 再添加自己
|
|
65
|
-
result.set(module.name, module);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
for (const name of selectedModules) {
|
|
69
|
-
addModule(name);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return Array.from(result.values());
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 获取前端应用的包名
|
|
77
|
-
* @param appType 应用类型
|
|
78
|
-
* @returns npm 包名
|
|
79
|
-
*/
|
|
80
|
-
export function getFrontendPackage(appType: string): string | undefined {
|
|
81
|
-
const app = FRONTEND_APP_TYPES.find((a) => a.name === appType);
|
|
82
|
-
return app?.package;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 获取可用的前端应用列表
|
|
87
|
-
* @returns 可用的应用类型列表
|
|
88
|
-
*/
|
|
89
|
-
export function getAvailableFrontendApps() {
|
|
90
|
-
return FRONTEND_APP_TYPES.filter((app) => app.available);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* 已知包的依赖关系(来自 sdk-meta.json)
|
|
95
|
-
*/
|
|
96
|
-
const KNOWN_PACKAGE_DEPS: Record<string, string[]> = {
|
|
97
|
-
"@mindbase/vue3-auth": ["@mindbase/vue3-kit", "@mindbase/vue3-client"],
|
|
98
|
-
"@mindbase/vue3-kv": ["@mindbase/vue3-kit", "@mindbase/vue3-client"],
|
|
99
|
-
"@mindbase/vue3-storage": ["@mindbase/vue3-kit", "@mindbase/vue3-client", "spark-md5"],
|
|
100
|
-
"@mindbase/vue3-command": ["@mindbase/vue3-kit", "@mindbase/vue3-client"],
|
|
101
|
-
"@mindbase/vue3-explorer": ["@mindbase/vue3-kit", "@mindbase/vue3-client"],
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* 解析前端应用依赖的包
|
|
106
|
-
* @param appType 应用类型
|
|
107
|
-
* @returns 包含所有依赖的完整包列表
|
|
108
|
-
*/
|
|
109
|
-
export function resolveFrontendDependencies(appType: string): string[] {
|
|
110
|
-
const packages = new Set<string>();
|
|
111
|
-
|
|
112
|
-
function addPackage(packageName: string) {
|
|
113
|
-
if (packages.has(packageName)) return;
|
|
114
|
-
|
|
115
|
-
// 添加当前包
|
|
116
|
-
packages.add(packageName);
|
|
117
|
-
|
|
118
|
-
// 查找是否有应用定义了这个包
|
|
119
|
-
const app = FRONTEND_APP_TYPES.find((a) => a.package === packageName);
|
|
120
|
-
if (app?.dependencies) {
|
|
121
|
-
for (const dep of app.dependencies) {
|
|
122
|
-
addPackage(dep);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// 处理已知的基础依赖关系
|
|
127
|
-
if (KNOWN_PACKAGE_DEPS[packageName]) {
|
|
128
|
-
for (const dep of KNOWN_PACKAGE_DEPS[packageName]) {
|
|
129
|
-
addPackage(dep);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const app = FRONTEND_APP_TYPES.find((a) => a.name === appType);
|
|
135
|
-
if (app) {
|
|
136
|
-
addPackage(app.package);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return Array.from(packages);
|
|
140
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"strict": true,
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"declarationMap": true
|
|
12
|
-
},
|
|
13
|
-
"include": ["src/**/*"],
|
|
14
|
-
"exclude": ["node_modules", "dist"]
|
|
15
|
-
}
|