moyan-mfw-cli 1.1.10-beta.0 → 1.1.10-beta.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/dist/index.cjs +12 -7
- package/dist/index.js +12 -7
- package/dist/templates/business/backend/.env.example +43 -0
- package/dist/templates/business/backend/.env.hbs +3 -0
- package/dist/templates/business/frontend/.env.example +18 -0
- package/dist/templates/extension/backend/.env.example +37 -0
- package/dist/templates/extension/backend/.env.hbs +2 -0
- package/dist/templates/extension/frontend/.env.example +18 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -141,13 +141,18 @@ async function renderTemplateToDir(templateDir, outputDir, vars) {
|
|
|
141
141
|
const files = await getAllFiles(templateDir);
|
|
142
142
|
for (const file of files) {
|
|
143
143
|
const relative4 = path2.relative(templateDir, file);
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
if (relative4.endsWith(".hbs")) {
|
|
145
|
+
const outputNameRaw = relative4.replace(/\.hbs$/, "").replace(/\\/g, "/");
|
|
146
|
+
const outputName = import_handlebars.default.compile(outputNameRaw)(vars);
|
|
147
|
+
const outputPath = path2.join(outputDir, outputName);
|
|
148
|
+
const raw = await renderTemplate(file, vars);
|
|
149
|
+
const content = await formatContent(raw, outputPath);
|
|
150
|
+
await writeFile2(outputPath, content);
|
|
151
|
+
} else {
|
|
152
|
+
const outputPath = path2.join(outputDir, relative4);
|
|
153
|
+
await ensureDir(path2.dirname(outputPath));
|
|
154
|
+
await fs2.copyFile(file, outputPath);
|
|
155
|
+
}
|
|
151
156
|
}
|
|
152
157
|
}
|
|
153
158
|
async function getAllFiles(dir) {
|
package/dist/index.js
CHANGED
|
@@ -117,13 +117,18 @@ async function renderTemplateToDir(templateDir, outputDir, vars) {
|
|
|
117
117
|
const files = await getAllFiles(templateDir);
|
|
118
118
|
for (const file of files) {
|
|
119
119
|
const relative4 = path2.relative(templateDir, file);
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
if (relative4.endsWith(".hbs")) {
|
|
121
|
+
const outputNameRaw = relative4.replace(/\.hbs$/, "").replace(/\\/g, "/");
|
|
122
|
+
const outputName = Handlebars.compile(outputNameRaw)(vars);
|
|
123
|
+
const outputPath = path2.join(outputDir, outputName);
|
|
124
|
+
const raw = await renderTemplate(file, vars);
|
|
125
|
+
const content = await formatContent(raw, outputPath);
|
|
126
|
+
await writeFile2(outputPath, content);
|
|
127
|
+
} else {
|
|
128
|
+
const outputPath = path2.join(outputDir, relative4);
|
|
129
|
+
await ensureDir(path2.dirname(outputPath));
|
|
130
|
+
await fs2.copyFile(file, outputPath);
|
|
131
|
+
}
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
async function getAllFiles(dir) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 环境变量配置
|
|
2
|
+
# 复制此文件为 .env 并填写实际配置
|
|
3
|
+
|
|
4
|
+
# ==================== 应用配置 ====================
|
|
5
|
+
NODE_ENV=development
|
|
6
|
+
PORT=3000
|
|
7
|
+
APP_NAME=MyApp Backend
|
|
8
|
+
|
|
9
|
+
# ==================== 数据库配置 ====================
|
|
10
|
+
DB_TYPE=mysql
|
|
11
|
+
DB_HOST=localhost
|
|
12
|
+
DB_PORT=3306
|
|
13
|
+
DB_USERNAME=root
|
|
14
|
+
DB_PASSWORD=
|
|
15
|
+
DB_NAME=my_db
|
|
16
|
+
|
|
17
|
+
# ==================== Redis 配置 ====================
|
|
18
|
+
# 缓存驱动:none(不开启)| auto(自动降级)| redis(强制 Redis)| memory(强制内存)
|
|
19
|
+
CACHE_DRIVER=none
|
|
20
|
+
REDIS_HOST=localhost
|
|
21
|
+
REDIS_PORT=6379
|
|
22
|
+
REDIS_PASSWORD=
|
|
23
|
+
REDIS_DB=0
|
|
24
|
+
REDIS_KEY_PREFIX=mfw:
|
|
25
|
+
REDIS_DEFAULT_TTL=1800
|
|
26
|
+
|
|
27
|
+
# ==================== JWT 配置 ====================
|
|
28
|
+
JWT_SECRET=your-jwt-secret-change-in-production
|
|
29
|
+
JWT_EXPIRES_IN=7d
|
|
30
|
+
|
|
31
|
+
# ==================== CORS 配置 ====================
|
|
32
|
+
CORS_ORIGIN=*
|
|
33
|
+
|
|
34
|
+
# ==================== 日志配置 ====================
|
|
35
|
+
LOG_LEVEL=debug
|
|
36
|
+
SQL_LOGGING=true
|
|
37
|
+
|
|
38
|
+
# ==================== 用户配置 ====================
|
|
39
|
+
ADMIN_DEFAULT_PASSWORD_TYPE=fixed
|
|
40
|
+
ADMIN_DEFAULT_PASSWORD=Admin@123
|
|
41
|
+
|
|
42
|
+
# ==================== 上传配置 ====================
|
|
43
|
+
UPLOAD_DIR=uploads
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 前端环境变量配置
|
|
2
|
+
# 复制此文件为 .env 并填写实际配置
|
|
3
|
+
|
|
4
|
+
# ==================== 上传配置 ====================
|
|
5
|
+
# 上传类型:Form(本地上传)| Oss(阿里云 OSS)
|
|
6
|
+
VITE_UPLOAD_TYPE=Form
|
|
7
|
+
|
|
8
|
+
# Form 上传地址(仅 VITE_UPLOAD_TYPE=Form 时有效)
|
|
9
|
+
VITE_UPLOAD_FORM_URL=/api/upload-files
|
|
10
|
+
|
|
11
|
+
# OSS Endpoint(仅 VITE_UPLOAD_TYPE=Oss 时有效)
|
|
12
|
+
VITE_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
|
|
13
|
+
|
|
14
|
+
# OSS Bucket(仅 VITE_UPLOAD_TYPE=Oss 时有效)
|
|
15
|
+
VITE_OSS_BUCKET=my-bucket
|
|
16
|
+
|
|
17
|
+
# OSS 上传目录(仅 VITE_UPLOAD_TYPE=Oss 时有效)
|
|
18
|
+
VITE_OSS_DIR=uploads/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 扩展后端环境变量配置
|
|
2
|
+
# 复制此文件为 .env 并填写实际配置
|
|
3
|
+
|
|
4
|
+
# ==================== 应用配置 ====================
|
|
5
|
+
NODE_ENV=development
|
|
6
|
+
PORT=3001
|
|
7
|
+
|
|
8
|
+
# ==================== 数据库配置 ====================
|
|
9
|
+
DB_HOST=localhost
|
|
10
|
+
DB_PORT=3306
|
|
11
|
+
DB_USERNAME=root
|
|
12
|
+
DB_PASSWORD=
|
|
13
|
+
DB_NAME=moyan_ext
|
|
14
|
+
|
|
15
|
+
# ==================== Redis 配置 ====================
|
|
16
|
+
# 缓存驱动:none(不开启)| auto(自动降级)| redis(强制 Redis)| memory(强制内存)
|
|
17
|
+
CACHE_DRIVER=none
|
|
18
|
+
REDIS_HOST=localhost
|
|
19
|
+
REDIS_PORT=6379
|
|
20
|
+
REDIS_PASSWORD=
|
|
21
|
+
REDIS_DB=0
|
|
22
|
+
REDIS_KEY_PREFIX=mfw:
|
|
23
|
+
REDIS_DEFAULT_TTL=1800
|
|
24
|
+
|
|
25
|
+
# ==================== JWT 配置 ====================
|
|
26
|
+
JWT_SECRET=change-me-ext-jwt-secret
|
|
27
|
+
JWT_EXPIRES_IN=7d
|
|
28
|
+
|
|
29
|
+
# ==================== CORS 配置 ====================
|
|
30
|
+
CORS_ORIGIN=*
|
|
31
|
+
|
|
32
|
+
# ==================== 日志配置 ====================
|
|
33
|
+
LOG_LEVEL=debug
|
|
34
|
+
SQL_LOGGING=true
|
|
35
|
+
|
|
36
|
+
# ==================== 上传配置 ====================
|
|
37
|
+
UPLOAD_DIR=uploads
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 扩展前端环境变量配置
|
|
2
|
+
# 复制此文件为 .env 并填写实际配置
|
|
3
|
+
|
|
4
|
+
# ==================== 上传配置 ====================
|
|
5
|
+
# 上传类型:Form(本地上传)| Oss(阿里云 OSS)
|
|
6
|
+
VITE_UPLOAD_TYPE=Form
|
|
7
|
+
|
|
8
|
+
# Form 上传地址(仅 VITE_UPLOAD_TYPE=Form 时有效)
|
|
9
|
+
VITE_UPLOAD_FORM_URL=/api/upload-files
|
|
10
|
+
|
|
11
|
+
# OSS Endpoint(仅 VITE_UPLOAD_TYPE=Oss 时有效)
|
|
12
|
+
VITE_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
|
|
13
|
+
|
|
14
|
+
# OSS Bucket(仅 VITE_UPLOAD_TYPE=Oss 时有效)
|
|
15
|
+
VITE_OSS_BUCKET=my-bucket
|
|
16
|
+
|
|
17
|
+
# OSS 上传目录(仅 VITE_UPLOAD_TYPE=Oss 时有效)
|
|
18
|
+
VITE_OSS_DIR=uploads/
|