@fastcar/cli 0.1.1 → 0.1.3

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/bin/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const init = require("../src/init");
4
4
  const setModules = require("../src/setModules");
@@ -11,6 +11,7 @@ const {
11
11
  listTargets,
12
12
  initSkill,
13
13
  } = require("../src/skill");
14
+ const { updateCosTemplate } = require("../src/update");
14
15
  const packageINFO = require("../package.json");
15
16
  const templates = require("../src/templates.json");
16
17
 
@@ -26,10 +27,12 @@ Commands:
26
27
  clean node_modules 删除冗余的 node_modules 目录
27
28
  compress node_modules 压缩 node_modules 目录
28
29
  reverse 数据库表逆向生成
29
- reverse:init 生成 reverse.config.json 配置文件
30
+ reverse:init 生成 reverse.config.yml/json 配置文件
30
31
  pack [pm] 打包项目(排除 devDependencies)
31
32
  pm: 包管理器 (npm/yarn/pnpm),可选,默认自动检测
32
33
 
34
+ update:cos 更新 @fastcar/template-cos 的 target 文件夹
35
+
33
36
  skill install <name> 安装 FastCar skill 到本地 AI Agent
34
37
  -g, --global 安装到全局(默认)
35
38
  -l, --local 安装到项目级
@@ -54,11 +57,13 @@ Examples:
54
57
  $ fastcar-cli init web my-project # 使用 web 模板创建 my-project
55
58
  $ fastcar-cli clean node_modules
56
59
  $ fastcar-cli reverse # 数据库表逆向生成
57
- $ fastcar-cli reverse:init # 生成默认配置文件
60
+ $ fastcar-cli reverse:init # 生成默认配置文件(默认 YAML 格式)
58
61
  $ fastcar-cli pack # 打包项目(自动检测包管理器)
59
62
  $ fastcar-cli pack yarn # 使用 yarn 安装依赖
60
63
  $ fastcar-cli pack pnpm # 使用 pnpm 安装依赖
61
64
 
65
+ $ fastcar-cli update:cos # 更新 cos 模板的 target 文件夹
66
+
62
67
  $ fastcar-cli skill install fastcar-framework # 交互式安装
63
68
  $ fastcar-cli skill install fastcar-framework -g # 全局安装
64
69
  $ fastcar-cli skill install fastcar-framework -l # 本地安装
@@ -67,7 +72,7 @@ Examples:
67
72
  $ fastcar-cli skill targets # 列出支持的 agents
68
73
 
69
74
  Reverse 命令参数说明:
70
- 通过配置文件传入参数,在项目根目录创建 reverse.config.json:
75
+ 通过配置文件传入参数,在项目根目录创建 reverse.config.yml 或 reverse.config.json:
71
76
 
72
77
  {
73
78
  "tables": ["test"], // 要逆向生成的表名数组(必填)
@@ -100,7 +105,7 @@ function showVersion() {
100
105
  console.log(`fastcar-cli version ${packageINFO.version}`);
101
106
  }
102
107
 
103
- function run(argv) {
108
+ async function run(argv) {
104
109
  // 命令入口
105
110
  if (!argv || argv.length === 0) {
106
111
  showHelp();
@@ -122,7 +127,7 @@ function run(argv) {
122
127
  break;
123
128
  }
124
129
  case "init": {
125
- init(body);
130
+ await init(body);
126
131
  break;
127
132
  }
128
133
  case "clean":
@@ -139,11 +144,11 @@ function run(argv) {
139
144
  break;
140
145
  }
141
146
  case "reverse": {
142
- reverseGenerate(body);
147
+ await reverseGenerate(body);
143
148
  break;
144
149
  }
145
150
  case "reverse:init": {
146
- initReverseConfig();
151
+ await initReverseConfig();
147
152
  break;
148
153
  }
149
154
  case "pack": {
@@ -151,6 +156,10 @@ function run(argv) {
151
156
  packProject(null, null, pm);
152
157
  break;
153
158
  }
159
+ case "update:cos": {
160
+ await updateCosTemplate(body);
161
+ break;
162
+ }
154
163
  case "skill": {
155
164
  const subCmd = body[0];
156
165
  const args = body.slice(1);
@@ -220,4 +229,7 @@ function run(argv) {
220
229
  }
221
230
  }
222
231
 
223
- run(process.argv.slice(2));
232
+ run(process.argv.slice(2)).catch((err) => {
233
+ console.error(err);
234
+ process.exit(1);
235
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastcar/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "homepage": "https://william_zhong.coding.net/public/fast-car/fastcar-cli/git/files",
5
5
  "description": "fastcar-cli 脚手架快速搭建",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "commander": "^8.3.0",
25
25
  "compressing": "^1.5.1",
26
26
  "inquirer": "^8.2.0",
27
- "yaml": "^1.10.2"
27
+ "yaml": "^2.8.3"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",