create-koa-boot 1.0.0 → 1.0.2
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/ai/metadata.js +17 -8
- package/package.json +18 -1
package/ai/metadata.js
CHANGED
|
@@ -62,17 +62,26 @@ function toPermissions(seedSource) {
|
|
|
62
62
|
return items;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/** 依次探测候选路径,返回第一个存在的(适配纯后端骨架与三端 backend/ 结构) */
|
|
66
|
+
function resolvePath(targetDir, candidates) {
|
|
67
|
+
for (const c of candidates) {
|
|
68
|
+
const p = path.join(targetDir, c);
|
|
69
|
+
if (fs.existsSync(p)) return p;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
65
74
|
function runSync(targetDir, outDir) {
|
|
66
|
-
const schemaPath =
|
|
67
|
-
const swaggerPath =
|
|
68
|
-
const seedPath =
|
|
75
|
+
const schemaPath = resolvePath(targetDir, ['prisma/schema.prisma', 'backend/prisma/schema.prisma']);
|
|
76
|
+
const swaggerPath = resolvePath(targetDir, ['src/build/swagger.json', 'backend/src/build/swagger.json']);
|
|
77
|
+
const seedPath = resolvePath(targetDir, ['src/init/menu-seed.ts', 'backend/src/init/menu-seed.ts']);
|
|
69
78
|
const errors = [];
|
|
70
79
|
|
|
71
|
-
if (!
|
|
72
|
-
errors.push(`未找到
|
|
80
|
+
if (!schemaPath) {
|
|
81
|
+
errors.push(`未找到 prisma/schema.prisma(在项目根或 backend/ 下)`);
|
|
73
82
|
}
|
|
74
|
-
if (!
|
|
75
|
-
errors.push(`未找到
|
|
83
|
+
if (!swaggerPath) {
|
|
84
|
+
errors.push(`未找到 src/build/swagger.json(请先运行 pnpm doc 或 pnpm build 生成 swagger.json)`);
|
|
76
85
|
}
|
|
77
86
|
if (errors.length) {
|
|
78
87
|
for (const e of errors) console.error(' ✗ ' + e);
|
|
@@ -95,7 +104,7 @@ function runSync(targetDir, outDir) {
|
|
|
95
104
|
|
|
96
105
|
// 3. permissions.json(尽力解析,缺失不报错)
|
|
97
106
|
let permissions = [];
|
|
98
|
-
if (fs.existsSync(seedPath)) {
|
|
107
|
+
if (seedPath && fs.existsSync(seedPath)) {
|
|
99
108
|
permissions = toPermissions(fs.readFileSync(seedPath, 'utf8'));
|
|
100
109
|
}
|
|
101
110
|
fs.writeFileSync(path.join(outDir, 'permissions.json'), JSON.stringify(permissions, null, 2), 'utf8');
|
package/package.json
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-koa-boot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Scaffolding CLI: generate a koa-boot-runtime project with system routes, demo business modules and merged Prisma schema",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"koa",
|
|
7
|
+
"koa3",
|
|
8
|
+
"node",
|
|
9
|
+
"typescript",
|
|
10
|
+
"scaffold",
|
|
11
|
+
"cli",
|
|
12
|
+
"codegen",
|
|
13
|
+
"prisma",
|
|
14
|
+
"tsoa",
|
|
15
|
+
"fullstack",
|
|
16
|
+
"vue",
|
|
17
|
+
"admin",
|
|
18
|
+
"ai",
|
|
19
|
+
"code-generator",
|
|
20
|
+
"low-code"
|
|
21
|
+
],
|
|
5
22
|
"bin": {
|
|
6
23
|
"create-koa-boot": "bin/create-koa-boot.js"
|
|
7
24
|
},
|