GeezerVison is showing github.com — fix: docs order & some docs lint problems · li55/lowcode-engine@0dc59e8
File treeExpand file treeCollapse file tree Open diff view settings docs/guide/expand/editor/parts
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docs/docs/guide/expand/editor/parts/partsassets.md +7-7Lines changed: 7 additions & 7 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ sidebar_position: 4 | 5 | 5 |
| 6 | 6 | ## 介绍 | 7 | 7 |
| 8 | | -通过前述介绍,相信大家已经了解如何使用 「[Parts·造物](https://parts.lowcode-engine.cn/)」 来将已有的 React 组件快速接入低代码引擎,以及生产低代码组件。 | | 8 | +通过前述介绍,相信大家已经了解如何使用「[Parts·造物](https://parts.lowcode-engine.cn/)」来将已有的 React 组件快速接入低代码引擎,以及生产低代码组件。 | 9 | 9 |
| 10 | 10 | 大家在使用的过程中,可能会希望构建出来的资产包可以后续随时访问下载,或者希望构建资产包时各个组件的版本等信息可以持久化起来并且能够多人维护。 | 11 | 11 |
| @@ -20,7 +20,7 @@ sidebar_position: 4 | 20 | 20 |
| 21 | 21 | - 填写资产包名称 | 22 | 22 | - 配置资产包管理员,管理员拥有该资产包的所有权限,初始默认为资产包的创建者,还可以添加其他人作为管理员, | 23 | | -- 配置资产包描述(可选) | | 23 | +- 配置资产包描述 (可选) | 24 | 24 | - 点击 `确定`, 即可完成资产包的创建 | 25 | 25 |
| 26 | 26 | 接下来需要为资产包添加一个或者多个组件。 | @@ -43,20 +43,20 @@ sidebar_position: 4 | 43 | 43 | - `开启缓存` : 可充分利用之前的构建结果缓存来加速资产包的生成,我们会将每个组件的构建结果以 包名和版本号为 key 进行缓存。 | 44 | 44 | - `任务描述` : 当前构建任务的一些描述信息。 | 45 | 45 |
| 46 | | -点击 `确认` 按钮 会自动跳转到当前资产包的构建历史界面: | | 46 | +点击 `确认` 按钮 会自动跳转到当前资产包的构建历史界面: | 47 | 47 |  | 48 | | -构建历史界面会显示当前资产包所有的构建历史记录,表格状态栏展示了构建的状态:`成功`,`失败`,`正在运行` 三种状态, 操作列可以在构建成功时复制或者下载资产包结果 | | 48 | +构建历史界面会显示当前资产包所有的构建历史记录,表格状态栏展示了构建的状态:`成功`,`失败`,`正在运行` 三种状态,操作列可以在构建成功时复制或者下载资产包结果 | 49 | 49 |
| 50 | 50 | ## 使用资产包 | 51 | | -你可以在 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 中直接引用,可直接替换demo中原来的资产包文件: | | 51 | +你可以在 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 中直接引用,可直接替换 demo 中原来的资产包文件: | 52 | 52 | 例如,在 [demo-lowcode-component](https://github.com/alibaba/lowcode-demo/tree/main/demo-lowcode-component) 中,直接用你的资产包文件替换文件[assets.json](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/services/assets.json),即可快速使用自己的物料了。 | 53 | 53 |
| 54 | 54 | ### 在编辑器中使用资产包 | 55 | 55 | 在使用含有低代码组件的资产包注意 注意引擎版本必须大于等于 `1.1.0-beta.9`。 | 56 | 56 | 然后直接替换 [lowcode-demo](https://github.com/alibaba/lowcode-demo) demo 中的 `assets.json` 文件即可。 | 57 | 57 |
| 58 | 58 | ### 在预览中使用资产包 | 59 | | -在预览中使用资产包的整体思路是从 `资产包` 中提取并转换出 `ReactRenderer` 渲染所需要的 react 组件列表(`components` 参数),然后将 `schema` 以及 `components` 传入到 `ReactRenderer` 中进行渲染,需要注意的是,在 `资产包` 的转换过程中,我们也需要将 `低代码组件` 转换成 react 组件, 具体逻辑可以参考下 [demo-lowcode-component](https://github.com/alibaba/lowcode-demo/tree/main/demo-lowcode-component) 中 `src/parse-assets.ts` 文件的实现。 | | 59 | +在预览中使用资产包的整体思路是从 `资产包` 中提取并转换出 `ReactRenderer` 渲染所需要的 react 组件列表 (`components` 参数),然后将 `schema` 以及 `components` 传入到 `ReactRenderer` 中进行渲染,需要注意的是,在 `资产包` 的转换过程中,我们也需要将 `低代码组件` 转换成 react 组件,具体逻辑可以参考下 [demo-lowcode-component](https://github.com/alibaba/lowcode-demo/tree/main/demo-lowcode-component) 中 `src/parse-assets.ts` 文件的实现。 | 60 | 60 | 基于资产包进行预览的整体逻辑如下: [详见](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/preview.tsx): | 61 | 61 | ```ts | 62 | 62 | import ReactDOM from 'react-dom'; | @@ -125,7 +125,7 @@ const SamplePreview = () => { | 125 | 125 | ReactDOM.render(<SamplePreview />, document.getElementById('ice-container')); | 126 | 126 | ``` | 127 | 127 |
| 128 | | -从资产包中解析 react 组件列表的逻辑如下, [详见](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/parse-assets.ts): | | 128 | +从资产包中解析 react 组件列表的逻辑如下,[详见](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/parse-assets.ts): | 129 | 129 | ```ts | 130 | 130 | import { ComponentDescription, ComponentSchema, RemoteComponentDescription } from '@alilc/lowcode-types'; | 131 | 131 | import { buildComponents, AssetsJson, AssetLoader } from '@alilc/lowcode-utils'; | |
Collapse file Copy file name to clipboardExpand all lines: docs/docs/guide/expand/editor/parts/partslcc.md +8-8Lines changed: 8 additions & 8 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,17 +5,17 @@ sidebar_position: 2 | 5 | 5 | ## 什么是低代码组件 | 6 | 6 | 我们先了解一下什么是低代码组件,为什么要用低代码组件。 | 7 | 7 |
| 8 | | -低代码组件是通过可视化的方式生产的组件,这些组件既可以用于低代码搭建体系,也可以用于ProCode开发体系(后续迭代)。 | | 8 | +低代码组件是通过可视化的方式生产的组件,这些组件既可以用于低代码搭建体系,也可以用于 ProCode 开发体系(后续迭代)。 | 9 | 9 |
| 10 | 10 | 那么为什么我们要使用低代码的形式来开发组件: | 11 | | -* <font color="red"><b>首先</b></font>:<b>轻快</b>,低代码组件只需通过浏览器秒级完成初始化工作,不需要ProCode繁重的环境准备;<b>环境一致(低代码环境)</b>,同时能够保证物料的开发环境和真实的运行环境是一致的,不会存在开发和运行环境不一致的问题。 | | 11 | +* <font color="red"><b>首先</b></font>:<b>轻快</b>,低代码组件只需通过浏览器秒级完成初始化工作,不需要 ProCode 繁重的环境准备;<b>环境一致(低代码环境)</b>,同时能够保证物料的开发环境和真实的运行环境是一致的,不会存在开发和运行环境不一致的问题。 | 12 | 12 | * <font color="red"><b>其次</b></font>:<b>通用能力可视化方式抽象,提升研发效能</b>,比如获取远程数据、视图开发、依赖管理、生命周期、事件绑定等功能。 | 13 | 13 |
| 14 | | -<font color="red">低代码组件不是用来替代 ProCode 的开发方式</font>,而是让开发者可以从ProCode中重复的工作脱离出来,抽象更多业务垂直的能力,从而起到提效的作用。 | | 14 | +<font color="red">低代码组件不是用来替代 ProCode 的开发方式</font>,而是让开发者可以从 ProCode 中重复的工作脱离出来,抽象更多业务垂直的能力,从而起到提效的作用。 | 15 | 15 |
| 16 | 16 | ## 创建组件 | 17 | 17 |
| 18 | | -环境准备:我们可以通过Parts提供的通用[低代码组件开发环境](https://parts.lowcode-engine.cn/material#/)开发。 | | 18 | +环境准备:我们可以通过 Parts 提供的通用[低代码组件开发环境](https://parts.lowcode-engine.cn/material#/)开发。 | 19 | 19 |
| 20 | 20 | 点击开发新组件 --> 填写组件标题 --> 填写组件名称 --> 点击确定,完成组件创建工作。 | 21 | 21 |
| @@ -29,13 +29,13 @@ sidebar_position: 2 | 29 | 29 |
| 30 | 30 | ### 依赖管理 | 31 | 31 |
| 32 | | -依赖管理用于管理低代码组件本身的依赖(类似于dependencies)。步骤:点击添加组件 --> 选择安装的组件 --> 保存并构建 (需要等待几分钟构建)。 | | 32 | +依赖管理用于管理低代码组件本身的依赖(类似于 dependencies)。步骤:点击添加组件 --> 选择安装的组件 --> 保存并构建 (需要等待几分钟构建)。 | 33 | 33 |
| 34 | 34 |  | 35 | 35 |
| 36 | 36 | ### 属性定义 | 37 | 37 |
| 38 | | -用于定义组件接收外部传入的propTypes,组件内部可以通过<font color="red">this.props.${属性名称}</font>的方式获取属性值。 | | 38 | +用于定义组件接收外部传入的 propTypes,组件内部可以通过<font color="red">this.props.${属性名称}</font>的方式获取属性值。 | 39 | 39 |
| 40 | 40 | 属性定义前建议先阅读 [物料描述详解](https://lowcode-engine.cn/site/docs/guide/expand/editor/metaSpec)、[预置设置器](https://lowcode-engine.cn/site/docs/guide/appendix/setters)。 | 41 | 41 |
| @@ -45,7 +45,7 @@ sidebar_position: 2 | 45 | 45 |
| 46 | 46 | ### 生命周期 | 47 | 47 |
| 48 | | -低代码组件的开发支持componentDidMount、componentDidUpdate、componentDidCatch、componentWillUnmount几个生命周期 | | 48 | +低代码组件的开发支持 componentDidMount、componentDidUpdate、componentDidCatch、componentWillUnmount 几个生命周期 | 49 | 49 |
| 50 | 50 |  | 51 | 51 |
| @@ -55,7 +55,7 @@ sidebar_position: 2 | 55 | 55 |
| 56 | 56 |  | 57 | 57 |
| 58 | | -在低代码应用中使用,组件面板 --> 低代码组件, 找到对应的低代码组件拖入画布即可。 | | 58 | +在低代码应用中使用,组件面板 --> 低代码组件,找到对应的低代码组件拖入画布即可。 | 59 | 59 |
| 60 | 60 |  | 61 | 61 |
| |
Collapse file Copy file name to clipboardExpand all lines: docs/docs/guide/expand/editor/parts/prototype.md +3-3Lines changed: 3 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ sidebar_position: 3 | 51 | 51 | #### 给组件增加物料描述 | 52 | 52 |
| 53 | 53 | - 打开左侧 Setter 面板 | 54 | | -- 按照组件的属性拖入需要 Setter 类型 (如图中组件的width属性,拖入数字Setter) | | 54 | +- 按照组件的属性拖入需要 Setter 类型(如图中组件的 width 属性,拖入数字 Setter) | 55 | 55 | - 各种 Setter 的介绍可以参看这篇文档:[预置设置器列表](/site/docs/guide/appendix/setters) | 56 | 56 | - 配置属性的基本信息(如图所示) | 57 | 57 | - 配置完成后点击右上角的保存 | @@ -104,14 +104,14 @@ sidebar_position: 3 | 104 | 104 | 第三步:物料描述发布完成后,接下来我们就需要构建出可用的资产包用于低代码应用中。 | 105 | 105 |
| 106 | 106 | #### 资产包构建 | 107 | | -有两种方式可以构建资产包: | | 107 | +有两种方式可以构建资产包: | 108 | 108 | - 一种是通过 [`我的资产包`] 资产包管理模块进行整个资产包生命周期的管理,当然也包括资产包的构建,可参考 [资产包管理](./partsassets) | 109 | 109 | - 一种是通过 [`我的物料`] 组件物料管理模块的 `资产包构建` 进行构建, 具体操作如下: | 110 | 110 |
| 111 | 111 | - 选择需要构建的组件 | 112 | 112 | - 点击构建资产包按钮 | 113 | 113 | - 选择刚刚的物料描述配置 | 114 | | - - 开始构建,构建完成后你将得到一份json文件(里面包含了物料描述和umd包),就可以到项目中使用了 | | 114 | + - 开始构建,构建完成后你将得到一份 json 文件(里面包含了物料描述和 umd 包),就可以到项目中使用了 | 115 | 115 |
| 116 | 116 | #### 资产包使用 | 117 | 117 | 详情请参考 [资产包管理](./partsassets#使用资产包) | |
Collapse file Copy file name to clipboardExpand all lines: docs/scripts/getDocsFromDir.js +12-7Lines changed: 12 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,9 +8,14 @@ module.exports = function getDocsFromDir(dir, cateList) { | 8 | 8 | const baseDir = path.join(__dirname, '../docs/'); | 9 | 9 | const docsDir = path.join(baseDir, dir); | 10 | 10 |
| | 11 | + function isNil(value) { | | 12 | + return value === undefined || value === null; | | 13 | + } | | 14 | + | 11 | 15 | function getMarkdownOrder(filepath) { | 12 | | - const data = matter(fs.readFileSync(filepath, 'utf-8')).data; | 13 | | - return (data || {}).sidebar_position || 100; | | 16 | + const { data } = matter(fs.readFileSync(filepath, 'utf-8')); | | 17 | + const { sidebar_position } = data || {}; | | 18 | + return isNil(sidebar_position) ? 100 : sidebar_position; | 14 | 19 | } | 15 | 20 |
| 16 | 21 | const docs = glob.sync('*.md?(x)', { | @@ -19,17 +24,17 @@ module.exports = function getDocsFromDir(dir, cateList) { | 19 | 24 | }); | 20 | 25 |
| 21 | 26 | const result = docs | 22 | | - .filter(doc => !/^index.md(x)?$/.test(doc)) | 23 | | - .map(doc => { | | 27 | + .filter((doc) => !/^index.md(x)?$/.test(doc)) | | 28 | + .map((doc) => { | 24 | 29 | return path.join(docsDir, doc); | 25 | 30 | }) | 26 | 31 | .sort((a, b) => { | 27 | 32 | const orderA = getMarkdownOrder(a); | 28 | 33 | const orderB = getMarkdownOrder(b); | 29 | 34 |
| 30 | | - return orderB - orderA; | | 35 | + return orderA - orderB; | 31 | 36 | }) | 32 | | - .map(filepath => { | | 37 | + .map((filepath) => { | 33 | 38 | // /Users/xxx/site/docs/guide/basic/router.md => guide/basic/router | 34 | 39 | const id = path | 35 | 40 | .relative(baseDir, filepath) | @@ -38,7 +43,7 @@ module.exports = function getDocsFromDir(dir, cateList) { | 38 | 43 | return id; | 39 | 44 | }); | 40 | 45 |
| 41 | | - (cateList || []).forEach(item => { | | 46 | + (cateList || []).forEach((item) => { | 42 | 47 | const { dir, subCategory, ...otherConfig } = item; | 43 | 48 | const indexList = glob.sync('index.md?(x)', { | 44 | 49 | cwd: path.join(baseDir, dir), | |
|