diff --git a/docs/README.md b/docs/README.md index ca958736c8..bd9ebe4da1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -95,7 +95,6 @@ - [应用工具类管理](./api/backend-api/app-utility-management.md) - [区块管理](./api/backend-api/block-management-api.md) - [数据源管理](./api/backend-api/data-source-management.md) - - [DSL代码生成](./api/backend-api/dsl-code-generation.md) - [物料中心](./api/backend-api/material-center.md) - [页面管理](./api/backend-api/page-management-api.md) - [APP服务](./api/backend-api/app-services.md) diff --git a/docs/api/backend-api/dsl-code-generation.md b/docs/api/backend-api/dsl-code-generation.md deleted file mode 100644 index dd61638c0d..0000000000 --- a/docs/api/backend-api/dsl-code-generation.md +++ /dev/null @@ -1,104 +0,0 @@ -# DSL代码生成 - -## generateCode - - - -### 基本信息 - -**Path:** /generateCode - -**Method:** GET - -**接口描述:** - -
作为npm包使用generateCode方法生成代码示例:
-const path = require('path')
-const fs = require('fs')
-const { generateCode } = require('@opentiny/tiny-engine-dsl-ng-tiny/lib/generate-code.js')
-
-
-
-const result = generateCode({ pageInfo, blocksData })
-result.forEach((item) => fs.writeFileSync(`dist/${item.filePath}/${item.panelName}`, item.panelValue))
-
-
-输入示例: { pageInfo, blocksData };
-// pageInfo为页面的schema信息,
-// pageInfo: { schema, name });
-{
- name: 'page1',
- schema: {
- // 页面schema
- }
-}
-
-
-// blocksData为页面引用的区块的schema数据
-// blocksData: Array<{ label, content }>
-[
- {
- label: 'image-title',
- content: {
- // 区块的schema
- }
- },
- {
- // 其他区块...
- }
-]
-
-
-输出示例:
-[
- {
- "panelName": "page1.component.html", // 文件名
- "panelValue": "xxx", // 生成代码的内容
- "panelType": "html", // 生成代码的文件类型:html、css、ts
- "prettierOpt": { "parser": "html", "tabWidth": 2, "printWidth": 120 }, // prettier格式化选项
- "type": "page", // 生成代码类型:page、block、service
- "filePath": "pages/page1" // 生成代码文件的相对目录路径
- },
- {
- "panelName": "page1.component.ts",
- "panelValue": "xxx",
- "panelType": "ts",
- "prettierOpt": { "parser": "typescript", "tabWidth": 2, "printWidth": 120 },
- "type": "page",
- "filePath": "pages/page1"
- },
- {
- "panelName": "block1.component.ts",
- "type": "block",
- "panelType": "ts",
- "prettierOpt": { "parser": "typescript", "tabWidth": 2, "printWidth": 120 },
- "filePath": "blocks/block1",
- "panelValue": "xxx"
- },
- {
- "panelName": "fetch.service.ts",
- "panelType": "ts",
- "prettierOpt": { "parser": "typescript", "tabWidth": 2, "printWidth": 120 },
- "type": "service",
- "filePath": "service",
- "panelValue": "xxx"
- },
- // ...
-]
-
-
-
-
-### 请求参数
-
-### 返回数据
-
-| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | -
|---|---|---|---|---|---|
| object [] | 非必须 | item 类型: object | |||
| ├─ panelName | string | 必须 | 文件名 | ||
| ├─ panelValue | string | 必须 | 文件文本 | ||
| ├─ panelType | string | 必须 | 代码类型 | ||
| ├─ prettierOpt | object | 必须 | 代码美化选项 | ||
| ├─ parser | string | 非必须 | 指定要使用的解析器 | ||
| ├─ tabWidth | number | 非必须 | 指定使用几个空格来表示一个制表符(Tab) | ||
| ├─ printWidth | number | 非必须 | 指定每行代码的最大列数 | ||
| ├─ type | string | 必须 | 代码类型 | ||
| ├─ filePath | string | 必须 | 文件路径 |