@svton/cli 1.2.0 → 1.2.1

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.js CHANGED
@@ -685,7 +685,13 @@ async function initGit(projectName) {
685
685
  var import_fs_extra4 = __toESM(require("fs-extra"));
686
686
  var import_path3 = __toESM(require("path"));
687
687
  async function loadFeaturesConfig() {
688
- const configPath = import_path3.default.join(__dirname, "../../features.json");
688
+ const configPath = import_path3.default.join(__dirname, "../features.json");
689
+ if (!import_fs_extra4.default.existsSync(configPath)) {
690
+ const devPath = import_path3.default.join(__dirname, "../../features.json");
691
+ if (import_fs_extra4.default.existsSync(devPath)) {
692
+ return await import_fs_extra4.default.readJSON(devPath);
693
+ }
694
+ }
689
695
  return await import_fs_extra4.default.readJSON(configPath);
690
696
  }
691
697
  function getFeatureChoices(config) {
@@ -1071,7 +1077,7 @@ async function createProjectFromTemplate(config) {
1071
1077
  }
1072
1078
 
1073
1079
  // package.json
1074
- var version = "1.2.0";
1080
+ var version = "1.2.1";
1075
1081
 
1076
1082
  // src/index.ts
1077
1083
  async function cli() {
package/dist/index.mjs CHANGED
@@ -658,7 +658,13 @@ async function initGit(projectName) {
658
658
  import fs4 from "fs-extra";
659
659
  import path3 from "path";
660
660
  async function loadFeaturesConfig() {
661
- const configPath = path3.join(__dirname, "../../features.json");
661
+ const configPath = path3.join(__dirname, "../features.json");
662
+ if (!fs4.existsSync(configPath)) {
663
+ const devPath = path3.join(__dirname, "../../features.json");
664
+ if (fs4.existsSync(devPath)) {
665
+ return await fs4.readJSON(devPath);
666
+ }
667
+ }
662
668
  return await fs4.readJSON(configPath);
663
669
  }
664
670
  function getFeatureChoices(config) {
@@ -1044,7 +1050,7 @@ async function createProjectFromTemplate(config) {
1044
1050
  }
1045
1051
 
1046
1052
  // package.json
1047
- var version = "1.2.0";
1053
+ var version = "1.2.1";
1048
1054
 
1049
1055
  // src/index.ts
1050
1056
  async function cli() {
package/features.json ADDED
@@ -0,0 +1,339 @@
1
+ {
2
+ "features": {
3
+ "cache": {
4
+ "name": "缓存",
5
+ "description": "基于 Redis 的声明式缓存",
6
+ "category": "backend",
7
+ "packages": {
8
+ "dependencies": {
9
+ "@svton/nestjs-cache": "latest",
10
+ "@svton/nestjs-redis": "latest"
11
+ }
12
+ },
13
+ "envVars": [
14
+ { "key": "REDIS_HOST", "default": "localhost", "description": "Redis 主机地址" },
15
+ { "key": "REDIS_PORT", "default": "6379", "description": "Redis 端口" },
16
+ { "key": "REDIS_PASSWORD", "default": "", "description": "Redis 密码(可选)" }
17
+ ],
18
+ "configFiles": [
19
+ {
20
+ "path": "src/config/cache.config.ts",
21
+ "template": "configs/cache.config.ts"
22
+ }
23
+ ],
24
+ "moduleImports": [
25
+ {
26
+ "from": "@svton/nestjs-cache",
27
+ "import": "CacheModule"
28
+ }
29
+ ],
30
+ "moduleRegistration": {
31
+ "type": "forRootAsync",
32
+ "module": "CacheModule",
33
+ "config": "useCacheConfig(configService)"
34
+ },
35
+ "exampleFiles": {
36
+ "source": "examples/cache",
37
+ "target": "src/examples/cache",
38
+ "description": "缓存装饰器使用示例"
39
+ },
40
+ "skillFile": {
41
+ "template": "skills/cache.skill.md",
42
+ "target": ".kiro/skills/cache.md"
43
+ }
44
+ },
45
+ "queue": {
46
+ "name": "消息队列",
47
+ "description": "基于 BullMQ 的异步任务处理",
48
+ "category": "backend",
49
+ "packages": {
50
+ "dependencies": {
51
+ "@svton/nestjs-queue": "latest",
52
+ "@svton/nestjs-redis": "latest"
53
+ }
54
+ },
55
+ "envVars": [
56
+ { "key": "REDIS_HOST", "default": "localhost", "description": "Redis 主机地址" },
57
+ { "key": "REDIS_PORT", "default": "6379", "description": "Redis 端口" }
58
+ ],
59
+ "configFiles": [
60
+ {
61
+ "path": "src/config/queue.config.ts",
62
+ "template": "configs/queue.config.ts"
63
+ }
64
+ ],
65
+ "moduleImports": [
66
+ {
67
+ "from": "@svton/nestjs-queue",
68
+ "import": "QueueModule"
69
+ }
70
+ ],
71
+ "moduleRegistration": {
72
+ "type": "forRootAsync",
73
+ "module": "QueueModule",
74
+ "config": "useQueueConfig(configService)"
75
+ },
76
+ "exampleFiles": {
77
+ "source": "examples/queue",
78
+ "target": "src/examples/queue",
79
+ "description": "队列任务处理示例"
80
+ },
81
+ "skillFile": {
82
+ "template": "skills/queue.skill.md",
83
+ "target": ".kiro/skills/queue.md"
84
+ }
85
+ },
86
+ "payment": {
87
+ "name": "支付",
88
+ "description": "微信支付 + 支付宝",
89
+ "category": "backend",
90
+ "packages": {
91
+ "dependencies": {
92
+ "@svton/nestjs-payment": "latest"
93
+ }
94
+ },
95
+ "envVars": [
96
+ { "key": "WECHAT_MCH_ID", "default": "", "description": "微信商户号" },
97
+ { "key": "WECHAT_PRIVATE_KEY", "default": "", "description": "微信商户 API 私钥路径" },
98
+ { "key": "WECHAT_SERIAL_NO", "default": "", "description": "微信商户 API 证书序列号" },
99
+ { "key": "WECHAT_API_V3_KEY", "default": "", "description": "微信 APIv3 密钥" },
100
+ { "key": "WECHAT_APP_ID", "default": "", "description": "微信关联的 AppID" },
101
+ { "key": "ALIPAY_APP_ID", "default": "", "description": "支付宝应用 ID" },
102
+ { "key": "ALIPAY_PRIVATE_KEY", "default": "", "description": "支付宝应用私钥路径" },
103
+ { "key": "ALIPAY_PUBLIC_KEY", "default": "", "description": "支付宝公钥路径" }
104
+ ],
105
+ "configFiles": [
106
+ {
107
+ "path": "src/config/payment.config.ts",
108
+ "template": "configs/payment.config.ts"
109
+ }
110
+ ],
111
+ "moduleImports": [
112
+ {
113
+ "from": "@svton/nestjs-payment",
114
+ "import": "PaymentModule"
115
+ }
116
+ ],
117
+ "moduleRegistration": {
118
+ "type": "forRootAsync",
119
+ "module": "PaymentModule",
120
+ "config": "usePaymentConfig(configService)"
121
+ },
122
+ "exampleFiles": {
123
+ "source": "examples/payment",
124
+ "target": "src/examples/payment",
125
+ "description": "支付功能示例(微信/支付宝)"
126
+ },
127
+ "skillFile": {
128
+ "template": "skills/payment.skill.md",
129
+ "target": ".kiro/skills/payment.md"
130
+ }
131
+ },
132
+ "oauth": {
133
+ "name": "OAuth 登录",
134
+ "description": "微信登录(开放平台/公众号/小程序)",
135
+ "category": "backend",
136
+ "packages": {
137
+ "dependencies": {
138
+ "@svton/nestjs-oauth": "latest"
139
+ }
140
+ },
141
+ "envVars": [
142
+ { "key": "WECHAT_OPEN_APP_ID", "default": "", "description": "微信开放平台 AppID" },
143
+ { "key": "WECHAT_OPEN_APP_SECRET", "default": "", "description": "微信开放平台 AppSecret" },
144
+ { "key": "WECHAT_MINI_APP_ID", "default": "", "description": "微信小程序 AppID" },
145
+ { "key": "WECHAT_MINI_APP_SECRET", "default": "", "description": "微信小程序 AppSecret" }
146
+ ],
147
+ "configFiles": [
148
+ {
149
+ "path": "src/config/oauth.config.ts",
150
+ "template": "configs/oauth.config.ts"
151
+ }
152
+ ],
153
+ "moduleImports": [
154
+ {
155
+ "from": "@svton/nestjs-oauth",
156
+ "import": "OAuthModule"
157
+ }
158
+ ],
159
+ "moduleRegistration": {
160
+ "type": "forRootAsync",
161
+ "module": "OAuthModule",
162
+ "config": "useOAuthConfig(configService)"
163
+ },
164
+ "exampleFiles": {
165
+ "source": "examples/oauth",
166
+ "target": "src/examples/oauth",
167
+ "description": "OAuth 登录示例"
168
+ },
169
+ "skillFile": {
170
+ "template": "skills/oauth.skill.md",
171
+ "target": ".kiro/skills/oauth.md"
172
+ }
173
+ },
174
+ "sms": {
175
+ "name": "短信",
176
+ "description": "阿里云/腾讯云短信发送",
177
+ "category": "backend",
178
+ "packages": {
179
+ "dependencies": {
180
+ "@svton/nestjs-sms": "latest"
181
+ }
182
+ },
183
+ "envVars": [
184
+ { "key": "SMS_PROVIDER", "default": "aliyun", "description": "短信服务商 (aliyun/tencent)" },
185
+ { "key": "SMS_ACCESS_KEY_ID", "default": "", "description": "AccessKey ID" },
186
+ { "key": "SMS_ACCESS_KEY_SECRET", "default": "", "description": "AccessKey Secret" },
187
+ { "key": "SMS_SIGN_NAME", "default": "", "description": "短信签名" }
188
+ ],
189
+ "configFiles": [
190
+ {
191
+ "path": "src/config/sms.config.ts",
192
+ "template": "configs/sms.config.ts"
193
+ }
194
+ ],
195
+ "moduleImports": [
196
+ {
197
+ "from": "@svton/nestjs-sms",
198
+ "import": "SmsModule"
199
+ }
200
+ ],
201
+ "moduleRegistration": {
202
+ "type": "forRootAsync",
203
+ "module": "SmsModule",
204
+ "config": "useSmsConfig(configService)"
205
+ },
206
+ "exampleFiles": {
207
+ "source": "examples/sms",
208
+ "target": "src/examples/sms",
209
+ "description": "短信发送示例"
210
+ },
211
+ "skillFile": {
212
+ "template": "skills/sms.skill.md",
213
+ "target": ".kiro/skills/sms.md"
214
+ }
215
+ },
216
+ "storage": {
217
+ "name": "对象存储",
218
+ "description": "七牛云/阿里云 OSS",
219
+ "category": "backend",
220
+ "packages": {
221
+ "dependencies": {
222
+ "@svton/nestjs-object-storage": "latest",
223
+ "@svton/nestjs-object-storage-qiniu-kodo": "latest"
224
+ }
225
+ },
226
+ "envVars": [
227
+ { "key": "STORAGE_PROVIDER", "default": "qiniu", "description": "存储服务商 (qiniu/aliyun)" },
228
+ { "key": "QINIU_ACCESS_KEY", "default": "", "description": "七牛云 AccessKey" },
229
+ { "key": "QINIU_SECRET_KEY", "default": "", "description": "七牛云 SecretKey" },
230
+ { "key": "QINIU_BUCKET", "default": "", "description": "七牛云存储空间名称" },
231
+ { "key": "QINIU_DOMAIN", "default": "", "description": "七牛云 CDN 域名" }
232
+ ],
233
+ "configFiles": [
234
+ {
235
+ "path": "src/config/storage.config.ts",
236
+ "template": "configs/storage.config.ts"
237
+ }
238
+ ],
239
+ "moduleImports": [
240
+ {
241
+ "from": "@svton/nestjs-object-storage",
242
+ "import": "ObjectStorageModule"
243
+ }
244
+ ],
245
+ "moduleRegistration": {
246
+ "type": "forRootAsync",
247
+ "module": "ObjectStorageModule",
248
+ "config": "useStorageConfig(configService)"
249
+ },
250
+ "exampleFiles": {
251
+ "source": "examples/storage",
252
+ "target": "src/examples/storage",
253
+ "description": "文件上传示例"
254
+ },
255
+ "skillFile": {
256
+ "template": "skills/storage.skill.md",
257
+ "target": ".kiro/skills/storage.md"
258
+ }
259
+ },
260
+ "rateLimit": {
261
+ "name": "限流",
262
+ "description": "接口访问频率限制",
263
+ "category": "backend",
264
+ "packages": {
265
+ "dependencies": {
266
+ "@svton/nestjs-rate-limit": "latest",
267
+ "@svton/nestjs-redis": "latest"
268
+ }
269
+ },
270
+ "envVars": [
271
+ { "key": "REDIS_HOST", "default": "localhost", "description": "Redis 主机地址" },
272
+ { "key": "REDIS_PORT", "default": "6379", "description": "Redis 端口" }
273
+ ],
274
+ "configFiles": [
275
+ {
276
+ "path": "src/config/rate-limit.config.ts",
277
+ "template": "configs/rate-limit.config.ts"
278
+ }
279
+ ],
280
+ "moduleImports": [
281
+ {
282
+ "from": "@svton/nestjs-rate-limit",
283
+ "import": "RateLimitModule"
284
+ }
285
+ ],
286
+ "moduleRegistration": {
287
+ "type": "forRootAsync",
288
+ "module": "RateLimitModule",
289
+ "config": "useRateLimitConfig(configService)"
290
+ },
291
+ "exampleFiles": {
292
+ "source": "examples/rate-limit",
293
+ "target": "src/examples/rate-limit",
294
+ "description": "限流使用示例"
295
+ },
296
+ "skillFile": {
297
+ "template": "skills/rate-limit.skill.md",
298
+ "target": ".kiro/skills/rate-limit.md"
299
+ }
300
+ },
301
+ "authz": {
302
+ "name": "权限控制",
303
+ "description": "RBAC 权限管理",
304
+ "category": "backend",
305
+ "packages": {
306
+ "dependencies": {
307
+ "@svton/nestjs-authz": "latest"
308
+ }
309
+ },
310
+ "envVars": [],
311
+ "configFiles": [
312
+ {
313
+ "path": "src/config/authz.config.ts",
314
+ "template": "configs/authz.config.ts"
315
+ }
316
+ ],
317
+ "moduleImports": [
318
+ {
319
+ "from": "@svton/nestjs-authz",
320
+ "import": "AuthzModule"
321
+ }
322
+ ],
323
+ "moduleRegistration": {
324
+ "type": "forRootAsync",
325
+ "module": "AuthzModule",
326
+ "config": "useAuthzConfig(configService)"
327
+ },
328
+ "exampleFiles": {
329
+ "source": "examples/authz",
330
+ "target": "src/examples/authz",
331
+ "description": "权限控制示例"
332
+ },
333
+ "skillFile": {
334
+ "template": "skills/authz.skill.md",
335
+ "target": ".kiro/skills/authz.md"
336
+ }
337
+ }
338
+ }
339
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svton/cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Svton CLI - Create full-stack applications with NestJS, Next.js, and Taro",
5
5
  "keywords": [
6
6
  "cli",
@@ -30,6 +30,7 @@
30
30
  "files": [
31
31
  "dist",
32
32
  "bin",
33
+ "features.json",
33
34
  "README.md",
34
35
  "LICENSE"
35
36
  ],