cloudcc-cli 2.3.2 → 2.3.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/.claude/settings.json +12 -2
- package/.cursor/skills/cloudcc-cli-usage/SKILL.md +2 -1
- package/README.md +11 -0
- package/package.json +2 -1
- package/src/classes/docs/devguide.md +90 -0
- package/src/globalSelectList/docs/devguide.md +0 -59
- package/src/menu/docs/devguide.md +57 -131
- package/src/pagelayout/create.js +2 -2
- package/src/pagelayout/delete.js +57 -0
- package/src/pagelayout/docs/devguide.md +17 -229
- package/src/pagelayout/get.js +9 -9
- package/src/pagelayout/index.js +1 -0
- package/src/plugin/docs/devguide.md +90 -17
- package/src/profile/docs/devguide.md +3 -258
- package/src/role/docs/devguide.md +5 -311
- package/src/timer/docs/devguide.md +83 -1
- package/src/triggers/docs/devguide.md +108 -0
- package/src/user/docs/devguide.md +22 -534
- package/tmp_customsetting_detail.json +0 -1
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
# CloudCC
|
|
1
|
+
# CloudCC 页面布局 CLI 命令说明
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**前置条件**:页面布局操作需要先选中自定义对象或标准对象。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 快速开始(CLI 命令)
|
|
10
|
-
|
|
11
|
-
### 支持的页面布局操作
|
|
3
|
+
## 支持的命令
|
|
12
4
|
|
|
13
5
|
| 操作 | 说明 |
|
|
14
6
|
|------|------|
|
|
15
7
|
| `get` | 查询页面布局列表 |
|
|
16
8
|
| `create` | 创建/复制页面布局 |
|
|
17
|
-
|
|
18
|
-
---
|
|
9
|
+
| `delete` | 删除页面布局 |
|
|
19
10
|
|
|
20
11
|
## CLI 命令详解
|
|
21
12
|
|
|
22
13
|
### 查询页面布局列表
|
|
23
14
|
|
|
24
|
-
获取指定对象的页面布局列表。
|
|
25
|
-
|
|
26
15
|
```bash
|
|
27
|
-
cc get pagelayout <projectPath> <
|
|
16
|
+
cc get pagelayout <projectPath> <prefix>
|
|
28
17
|
```
|
|
29
18
|
|
|
30
19
|
**参数说明:**
|
|
@@ -32,7 +21,7 @@ cc get pagelayout <projectPath> <objApiName>
|
|
|
32
21
|
| 参数 | 必填 | 说明 |
|
|
33
22
|
|------|------|------|
|
|
34
23
|
| `projectPath` | 否 | 项目路径,`.` 表示当前目录 |
|
|
35
|
-
| `
|
|
24
|
+
| `prefix` | 是 | 对象前缀(如 001, b25) |
|
|
36
25
|
|
|
37
26
|
**示例:**
|
|
38
27
|
|
|
@@ -40,16 +29,12 @@ cc get pagelayout <projectPath> <objApiName>
|
|
|
40
29
|
# 查询对象 b25 的页面布局列表
|
|
41
30
|
cc get pagelayout . b25
|
|
42
31
|
|
|
43
|
-
#
|
|
44
|
-
cc get pagelayout .
|
|
32
|
+
# 查询客户对象(001)的页面布局列表
|
|
33
|
+
cc get pagelayout . 001
|
|
45
34
|
```
|
|
46
35
|
|
|
47
|
-
---
|
|
48
|
-
|
|
49
36
|
### 创建页面布局
|
|
50
37
|
|
|
51
|
-
基于现有布局创建新的页面布局。
|
|
52
|
-
|
|
53
38
|
```bash
|
|
54
39
|
cc create pagelayout <projectPath> <objId> <layoutName> [sourceLayoutId] [isCloneDynamic]
|
|
55
40
|
```
|
|
@@ -77,219 +62,22 @@ cc create pagelayout . 20267D1465464C5OB6m5 "课程表2" add20261DA7347CZPAUz
|
|
|
77
62
|
cc create pagelayout . 20267D1465464C5OB6m5 "课程表2" add20261DA7347CZPAUz false
|
|
78
63
|
```
|
|
79
64
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## 完整工作流示例
|
|
83
|
-
|
|
84
|
-
### 场景:为自定义对象创建新的页面布局
|
|
65
|
+
### 删除页面布局
|
|
85
66
|
|
|
86
67
|
```bash
|
|
87
|
-
|
|
88
|
-
cat cloudcc-cli.config.js
|
|
89
|
-
|
|
90
|
-
# 2. 查询对象的页面布局列表
|
|
91
|
-
cc get pagelayout . b25
|
|
92
|
-
|
|
93
|
-
# 3. 根据对象 ID 创建新布局
|
|
94
|
-
cc create pagelayout . 20267D1465464C5OB6m5 "新的布局名称"
|
|
95
|
-
|
|
96
|
-
# 4. 验证创建成功,再次查询列表
|
|
97
|
-
cc get pagelayout . b25
|
|
68
|
+
cc delete pagelayout <projectPath> <layoutId>
|
|
98
69
|
```
|
|
99
70
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## API 接口详情
|
|
103
|
-
|
|
104
|
-
### 什么是页面布局?
|
|
105
|
-
|
|
106
|
-
**页面布局(Page Layout)** 定义了对象在详情页的展示方式,包括:
|
|
107
|
-
- 字段的排列和分组
|
|
108
|
-
- 相关列表的显示
|
|
109
|
-
- 操作按钮的位置
|
|
110
|
-
- 动态布局规则
|
|
111
|
-
|
|
112
|
-
### 核心属性
|
|
113
|
-
|
|
114
|
-
| 属性 | 说明 | 示例 |
|
|
115
|
-
|------|------|------|
|
|
116
|
-
| **ID(id)** | 页面布局唯一标识 | `add20261DA7347CZPAUz` |
|
|
117
|
-
| **名称(layoutName)** | 页面布局显示名称 | `课程表布局` |
|
|
118
|
-
| **对象 ID(objid)** | 关联的对象 ID | `20267D1465464C5OB6m5` |
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## 一、查询页面布局列表
|
|
123
|
-
|
|
124
|
-
### 1.1 接口说明
|
|
125
|
-
|
|
126
|
-
**接口**: `POST /api/layout/queryPageLayout`
|
|
127
|
-
|
|
128
|
-
**请求参数**:
|
|
129
|
-
|
|
130
|
-
| 参数名 | 类型 | 必填 | 说明 |
|
|
131
|
-
|--------|------|------|------|
|
|
132
|
-
| `prefix` | string | 是 | 对象 API 名称前缀 |
|
|
133
|
-
|
|
134
|
-
**返回数据**:
|
|
135
|
-
|
|
136
|
-
```javascript
|
|
137
|
-
{
|
|
138
|
-
"result": true,
|
|
139
|
-
"returnInfo": "操作成功",
|
|
140
|
-
"layouts": [
|
|
141
|
-
{
|
|
142
|
-
"id": "add20261DA7347CZPAUz",
|
|
143
|
-
"layoutName": "默认布局",
|
|
144
|
-
"objid": "20267D1465464C5OB6m5",
|
|
145
|
-
// ... 其他字段
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**返回字段说明**:
|
|
71
|
+
**参数说明:**
|
|
152
72
|
|
|
153
|
-
|
|
|
73
|
+
| 参数 | 必填 | 说明 |
|
|
154
74
|
|------|------|------|
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `layouts[].layoutName` | string | 布局名称 |
|
|
158
|
-
| `layouts[].objid` | string | 关联对象 ID |
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## 二、创建页面布局
|
|
163
|
-
|
|
164
|
-
创建页面布局是一个两步流程:
|
|
165
|
-
|
|
166
|
-
1. **获取现有布局列表**:调用 `layout/newpage` 接口获取可用于复制的布局
|
|
167
|
-
2. **复制创建新布局**:调用 `layout/cloneLayout` 接口基于选定布局创建新布局
|
|
168
|
-
|
|
169
|
-
### 2.1 获取现有布局列表
|
|
170
|
-
|
|
171
|
-
**接口**: `POST /api/layout/newpage`
|
|
172
|
-
|
|
173
|
-
**请求参数**:
|
|
174
|
-
|
|
175
|
-
| 参数名 | 类型 | 必填 | 说明 |
|
|
176
|
-
|--------|------|------|------|
|
|
177
|
-
| `objid` | string | 是 | 对象 ID |
|
|
178
|
-
|
|
179
|
-
**返回数据**:
|
|
180
|
-
|
|
181
|
-
```javascript
|
|
182
|
-
{
|
|
183
|
-
"result": true,
|
|
184
|
-
"returnInfo": "操作成功",
|
|
185
|
-
"layouts": [
|
|
186
|
-
{
|
|
187
|
-
"id": "add20261DA7347CZPAUz",
|
|
188
|
-
"layoutName": "默认布局",
|
|
189
|
-
"objid": "20267D1465464C5OB6m5"
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**默认布局选择逻辑**:
|
|
196
|
-
|
|
197
|
-
- 返回列表中的第一个布局作为默认复制源
|
|
198
|
-
|
|
199
|
-
### 2.2 复制创建新布局
|
|
200
|
-
|
|
201
|
-
**接口**: `POST /api/layout/cloneLayout`
|
|
202
|
-
|
|
203
|
-
**请求参数**:
|
|
204
|
-
|
|
205
|
-
| 参数名 | 类型 | 必填 | 说明 |
|
|
206
|
-
|--------|------|------|------|
|
|
207
|
-
| `layoutId` | string | 是 | 要复制的源布局 ID |
|
|
208
|
-
| `layoutName` | string | 是 | 新布局名称 |
|
|
209
|
-
| `objid` | string | 是 | 对象 ID |
|
|
210
|
-
| `isCloneDynamic` | string | 否 | 是否复制动态布局规则,默认 `"true"` |
|
|
211
|
-
|
|
212
|
-
**请求示例**:
|
|
213
|
-
|
|
214
|
-
```javascript
|
|
215
|
-
{
|
|
216
|
-
"layoutId": "add20261DA7347CZPAUz",
|
|
217
|
-
"layoutName": "课程表2",
|
|
218
|
-
"objid": "20267D1465464C5OB6m5",
|
|
219
|
-
"isCloneDynamic": "true"
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**返回数据**:
|
|
224
|
-
|
|
225
|
-
```javascript
|
|
226
|
-
{
|
|
227
|
-
"result": true,
|
|
228
|
-
"returnInfo": "操作成功",
|
|
229
|
-
"data": {
|
|
230
|
-
"id": "add2026XXXXXXXXXXXXX",
|
|
231
|
-
"layoutName": "课程表2"
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## 三、页面布局数据结构
|
|
75
|
+
| `projectPath` | 否 | 项目路径,`.` 表示当前目录 |
|
|
76
|
+
| `layoutId` | 是 | 要删除的页面布局 ID |
|
|
239
77
|
|
|
240
|
-
|
|
78
|
+
**示例:**
|
|
241
79
|
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
layoutName: "默认布局",
|
|
246
|
-
objid: "20267D1465464C5OB6m5"
|
|
247
|
-
}
|
|
80
|
+
```bash
|
|
81
|
+
# 删除指定页面布局
|
|
82
|
+
cc delete pagelayout . add202610BD89F09XyGT
|
|
248
83
|
```
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## 四、最佳实践
|
|
253
|
-
|
|
254
|
-
### 命名规范
|
|
255
|
-
|
|
256
|
-
| 项目 | 规范 | 示例 |
|
|
257
|
-
|------|------|------|
|
|
258
|
-
| 布局名称 | 使用描述性名称 | `标准详情页布局`、`移动端布局` |
|
|
259
|
-
| 复制源选择 | 选择结构最相近的布局作为复制源 | - |
|
|
260
|
-
|
|
261
|
-
### 布局设计建议
|
|
262
|
-
|
|
263
|
-
- **按需复制动态布局规则**:如果源布局有复杂的动态规则,确认是否需要复制到新布局
|
|
264
|
-
- **避免重复创建**:创建前先查询现有布局,避免重复
|
|
265
|
-
|
|
266
|
-
### 推荐操作流程
|
|
267
|
-
|
|
268
|
-
1. 查看对象现有布局:`cc get pagelayout . <apiName>`
|
|
269
|
-
2. 确定复制源布局 ID
|
|
270
|
-
3. 创建新布局:`cc create pagelayout . <objId> <layoutName> [sourceLayoutId]`
|
|
271
|
-
4. 验证创建结果
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## 五、常见问题
|
|
276
|
-
|
|
277
|
-
**Q: 为什么查询页面布局需要先选中对象?**
|
|
278
|
-
|
|
279
|
-
A: 页面布局是绑定到具体对象的,不同对象有不同的字段和关联关系,因此必须先确定对象才能操作其页面布局。
|
|
280
|
-
|
|
281
|
-
**Q: 如何获取对象 ID?**
|
|
282
|
-
|
|
283
|
-
A: 可以通过对象 API 名称查询对象信息获取 ID,或从管理后台的对象管理页面获取。
|
|
284
|
-
|
|
285
|
-
**Q: isCloneDynamic 参数的作用是什么?**
|
|
286
|
-
|
|
287
|
-
A: 该参数控制是否复制源布局的动态布局规则。设置为 `"true"` 时会复制动态规则,设置为 `"false"` 则只复制静态布局。
|
|
288
|
-
|
|
289
|
-
**Q: 创建页面布局时报错 "对象不存在"?**
|
|
290
|
-
|
|
291
|
-
A: 请确认传入的 `objId` 是正确的对象 ID,且该对象在当前环境中存在。
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
*文档版本:1.0 | 最后更新:2026-03-26*
|
package/src/pagelayout/get.js
CHANGED
|
@@ -4,21 +4,21 @@ const chalk = require("chalk");
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 查询页面布局列表
|
|
7
|
-
* 用法:cc get pagelayout <projectPath> <
|
|
7
|
+
* 用法:cc get pagelayout <projectPath> <prefix>
|
|
8
8
|
*/
|
|
9
9
|
async function get(argvs, isMcp = false) {
|
|
10
10
|
const projectPath = argvs[2] || process.cwd();
|
|
11
|
-
const
|
|
11
|
+
const prefix = argvs[3];
|
|
12
12
|
|
|
13
|
-
if (!
|
|
13
|
+
if (!prefix) {
|
|
14
14
|
console.error();
|
|
15
|
-
console.error(chalk.red("Error:
|
|
16
|
-
console.error("用法: cc get pagelayout <projectPath> <
|
|
15
|
+
console.error(chalk.red("Error: 缺少对象前缀"));
|
|
16
|
+
console.error("用法: cc get pagelayout <projectPath> <prefix>");
|
|
17
17
|
console.error("示例:");
|
|
18
|
+
console.error(" cc get pagelayout . 001");
|
|
18
19
|
console.error(" cc get pagelayout . b25");
|
|
19
|
-
console.error(" cc get pagelayout . Account");
|
|
20
20
|
console.error();
|
|
21
|
-
throw new Error("缺少必需参数:
|
|
21
|
+
throw new Error("缺少必需参数: prefix");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const config = await getPackageJson(projectPath);
|
|
@@ -26,13 +26,13 @@ async function get(argvs, isMcp = false) {
|
|
|
26
26
|
const res = await postClass(
|
|
27
27
|
config.setupSvc + "/api/layout/queryPageLayout",
|
|
28
28
|
{
|
|
29
|
-
prefix:
|
|
29
|
+
prefix: prefix
|
|
30
30
|
},
|
|
31
31
|
config.accessToken
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
if (res && res.result) {
|
|
35
|
-
const layouts = res.layouts || [];
|
|
35
|
+
const layouts = res.data?.layouts || [];
|
|
36
36
|
if (!isMcp) {
|
|
37
37
|
console.log(JSON.stringify(layouts));
|
|
38
38
|
}
|
package/src/pagelayout/index.js
CHANGED
|
@@ -5,6 +5,68 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## CLI 与本地文件(必读)
|
|
9
|
+
|
|
10
|
+
`plugins/<插件名>/` 目录、`config.json` 以及首次发布写回的 `id` 均与 **cloudcc-cli** 的创建、发布、拉取逻辑绑定。**必须通过下列命令** 完成新建插件目录、与云端同步、发布与删除;不要手工整包复制其他项目的 `plugins/`、不要私自篡改 `config.json` 中的 `id` 或破坏元数据,否则容易导致编译入口错误、发布失败或与云端不一致。
|
|
11
|
+
|
|
12
|
+
**允许的做法**:在 CLI 已生成的目录内用 IDE 编辑 `.vue`、子组件与 `utils/` 等源码;与云端列表、详情、拉取、删除、发布相关的操作一律走命令。
|
|
13
|
+
|
|
14
|
+
执行命令前请确认:已完成 `cc doc project devguide` 中的环境初始化,项目根目录配置可用且具备 `accessToken`(发布流程还会使用 `pluginToken` / 账号密钥等,以你项目配置为准)。
|
|
15
|
+
|
|
16
|
+
### 命令总览(以代码实现为准)
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cc create plugin <name>
|
|
20
|
+
cc publish plugin <name>
|
|
21
|
+
cc get plugin [projectPath]
|
|
22
|
+
cc detail plugin <pluginName> [pluginId] [projectPath]
|
|
23
|
+
cc detail plugin "" <pluginId> [projectPath]
|
|
24
|
+
cc pull plugin <pluginNameOrId> [projectPath]
|
|
25
|
+
cc delete plugin <pluginNameOrId> [projectPath]
|
|
26
|
+
cc doc plugin <introduction|devguide>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
参数约定:
|
|
30
|
+
|
|
31
|
+
- `name` / `pluginName`:插件目录名,与 `plugins/<name>/` 一致。
|
|
32
|
+
- `projectPath`:项目根路径;不传则使用当前工作目录。`get` 的第一个可选参数即为 `projectPath`。
|
|
33
|
+
- `pluginNameOrId`:本地目录名,或云端组件 ID;若本地存在 `config.json` 且含 `id`,`pull` / `delete` 会优先使用该 `id`。
|
|
34
|
+
- `pluginId`:`detail` 仅查云端时,将 `pluginName` 置空:`cc detail plugin "" <pluginId>`。
|
|
35
|
+
|
|
36
|
+
### 命令作用摘要
|
|
37
|
+
|
|
38
|
+
| 命令 | 作用 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| `create` | 在 `plugins/<name>/` 生成入口 `.vue`、`components/`、`config.json` 等模板 |
|
|
41
|
+
| `publish` | 使用 `vue-cli-service` 编译并上传;首次成功且接口返回 `id` 时可写回 `config.json` |
|
|
42
|
+
| `get` | 拉取云端组件列表,标准输出为 JSON |
|
|
43
|
+
| `detail` | 按目录名读本地;或按 `pluginId` 读云端(不传 `pluginName` 时) |
|
|
44
|
+
| `pull` | 按本地 `id` 或按传入的 ID 从云端还原文件到本地 `plugins/` 等路径 |
|
|
45
|
+
| `delete` | 调用接口删除云端组件 |
|
|
46
|
+
| `doc` | 输出 `introduction` 或 `devguide`(`devguide` 含附录 CCDK SDK 速查) |
|
|
47
|
+
|
|
48
|
+
### 推荐操作顺序
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 1) 查看云端已有组件(可选)
|
|
52
|
+
cc get plugin .
|
|
53
|
+
|
|
54
|
+
# 2) 仅通过 create 生成目录与模板
|
|
55
|
+
cc create plugin my_plugin
|
|
56
|
+
|
|
57
|
+
# 3) 本地调试后发布(勿跳过 CLI 发布流程)
|
|
58
|
+
cc publish plugin my_plugin
|
|
59
|
+
|
|
60
|
+
# 4) 与云端对齐或迁移机器时拉取
|
|
61
|
+
cc pull plugin my_plugin
|
|
62
|
+
# 或已知云端 ID:cc pull plugin <id> .
|
|
63
|
+
|
|
64
|
+
# 5) 不再使用时删除云端组件
|
|
65
|
+
cc delete plugin my_plugin
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
8
70
|
## 0. 自定义组件概述(能力与场景)
|
|
9
71
|
|
|
10
72
|
本文节整合了仓库内实践用法,帮助你在开始编码前先判断:什么是自定义组件、能解决什么问题、何时该用。
|
|
@@ -100,7 +162,8 @@ npm run serve
|
|
|
100
162
|
|
|
101
163
|
### 1.2 创建组件
|
|
102
164
|
|
|
103
|
-
-
|
|
165
|
+
- **使用本 CLI 时**:在项目根执行 `cc create plugin <name>`,会在 `plugins/<name>/` 生成标准模板(推荐)。
|
|
166
|
+
- 或在模板工程中手动新建入口文件,**组件名称必须满足 DOM 命名规则**,例如:`cc-com-demo.vue`
|
|
104
167
|
- 推荐遵循:以 `cc-` 开头,后续使用小写单词和 `-` 连接。
|
|
105
168
|
|
|
106
169
|
### 1.3 在 `App` 中引入组件
|
|
@@ -115,12 +178,15 @@ npm run serve
|
|
|
115
178
|
|
|
116
179
|
### 1.5 发布组件
|
|
117
180
|
|
|
118
|
-
|
|
181
|
+
**推荐(与仓库、CI 一致)**:在项目根目录执行:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cc publish plugin <与目录名一致的 name>
|
|
185
|
+
```
|
|
119
186
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
平台,可在页面编辑器中使用。
|
|
187
|
+
CLI 会编译 `plugins/<name>/<name>.vue` 并上传;首次成功且接口返回 `id` 时可能写回 `plugins/<name>/config.json`。
|
|
188
|
+
|
|
189
|
+
也可在 VS Code 中右键组件入口文件,选择「发布组件」(CloudCC 扩展),控制台提示成功即表示已上传至平台,可在页面编辑器中使用。
|
|
124
190
|
|
|
125
191
|
---
|
|
126
192
|
|
|
@@ -847,6 +913,7 @@ componentInfo: {
|
|
|
847
913
|
|
|
848
914
|
## 13. 自定义组件开发 Checklist
|
|
849
915
|
|
|
916
|
+
- [ ] 插件目录与云端同步仅通过 `cc create` / `cc publish` / `cc pull` / `cc delete` 等命令操作,不整包复制他人 `plugins/` 或手改 `config.json` 的 `id`
|
|
850
917
|
- [ ] 组件文件名与 `componentInfo.component` 命名符合规范(小写 + `-`
|
|
851
918
|
分隔,全局唯一)
|
|
852
919
|
- [ ] 样式默认使用 `lang="scss" scoped`,避免样式污染
|
|
@@ -860,7 +927,9 @@ componentInfo: {
|
|
|
860
927
|
|
|
861
928
|
---
|
|
862
929
|
|
|
863
|
-
## 14.
|
|
930
|
+
## 14. 命令使用说明(与实现一致)
|
|
931
|
+
|
|
932
|
+
文首「CLI 与本地文件(必读)」为总览;本节按子命令列出行为细节。
|
|
864
933
|
|
|
865
934
|
### 14.1 create
|
|
866
935
|
|
|
@@ -868,7 +937,7 @@ componentInfo: {
|
|
|
868
937
|
cc create plugin <name>
|
|
869
938
|
```
|
|
870
939
|
|
|
871
|
-
- 创建 `plugins/<name>/`
|
|
940
|
+
- 创建 `plugins/<name>/` 目录、入口 `<name>.vue`、`components/` 与 `config.json` 模板。
|
|
872
941
|
|
|
873
942
|
### 14.2 publish
|
|
874
943
|
|
|
@@ -876,8 +945,8 @@ cc create plugin <name>
|
|
|
876
945
|
cc publish plugin <name>
|
|
877
946
|
```
|
|
878
947
|
|
|
879
|
-
-
|
|
880
|
-
-
|
|
948
|
+
- 以 `plugins/<name>/<name>.vue` 为入口编译(`vue-cli-service build --target lib`),再上传到云端。
|
|
949
|
+
- 首次发布成功且响应包含 `id` 时,会写回 `plugins/<name>/config.json`(若此前无 `id`)。
|
|
881
950
|
|
|
882
951
|
### 14.3 get
|
|
883
952
|
|
|
@@ -885,17 +954,19 @@ cc publish plugin <name>
|
|
|
885
954
|
cc get plugin [projectPath]
|
|
886
955
|
```
|
|
887
956
|
|
|
888
|
-
-
|
|
957
|
+
- 分页请求云端组件列表,标准输出为 JSON 数组。
|
|
958
|
+
- `projectPath` 可选,用于解析项目根下的 `cloudcc-cli` 配置。
|
|
889
959
|
|
|
890
960
|
### 14.4 detail
|
|
891
961
|
|
|
892
962
|
```bash
|
|
893
|
-
cc detail plugin <pluginName> [projectPath]
|
|
963
|
+
cc detail plugin <pluginName> [pluginId] [projectPath]
|
|
894
964
|
cc detail plugin "" <pluginId> [projectPath]
|
|
895
965
|
```
|
|
896
966
|
|
|
897
|
-
-
|
|
898
|
-
-
|
|
967
|
+
- 提供 `pluginName`(且非空):读取本地 `plugins/<pluginName>/` 的 `config.json` 与入口 `.vue`。
|
|
968
|
+
- 将 `pluginName` 置为空并传 `pluginId`:仅从云端查询详情(`projectPath` 仍用于配置)。
|
|
969
|
+
- 需要指定项目根且保留「仅本地名」时,可用占位:`cc detail plugin <pluginName> "" <projectPath>`(中间空串表示无 `pluginId`)。
|
|
899
970
|
|
|
900
971
|
### 14.5 pull
|
|
901
972
|
|
|
@@ -903,7 +974,8 @@ cc detail plugin "" <pluginId> [projectPath]
|
|
|
903
974
|
cc pull plugin <pluginNameOrId> [projectPath]
|
|
904
975
|
```
|
|
905
976
|
|
|
906
|
-
-
|
|
977
|
+
- 若 `plugins/<输入>/config.json` 存在且含 `id`,按该 `id` 拉取。
|
|
978
|
+
- 否则将输入视为云端组件 ID,拉取后在 `plugins/<归一化名称>/` 等处落盘并更新 `config.json`。
|
|
907
979
|
|
|
908
980
|
### 14.6 delete
|
|
909
981
|
|
|
@@ -911,7 +983,8 @@ cc pull plugin <pluginNameOrId> [projectPath]
|
|
|
911
983
|
cc delete plugin <pluginNameOrId> [projectPath]
|
|
912
984
|
```
|
|
913
985
|
|
|
914
|
-
- 若本地 `config.json`
|
|
986
|
+
- 若本地 `plugins/<name>/config.json` 存在且含 `id`,优先按该 `id` 调删除接口。
|
|
987
|
+
- 否则将参数视为云端 ID 直接删除。
|
|
915
988
|
|
|
916
989
|
### 14.7 doc
|
|
917
990
|
|
|
@@ -920,4 +993,4 @@ cc doc plugin introduction
|
|
|
920
993
|
cc doc plugin devguide
|
|
921
994
|
```
|
|
922
995
|
|
|
923
|
-
-
|
|
996
|
+
- 仅支持 `introduction` 与 `devguide`;`devguide` 会在正文后拼接附录「CCDK SDK 速查」。
|