vueComponent / ant-design-vue-helper

A vscode extension for Ant-Design-Vue
45 stars 24 forks source link

按当前最新版本ant-design-vue生成对应的json及JS配置文件 #17

Closed chsword closed 1 year ago

chsword commented 4 years ago
  1. 更新了新的 vscode 依赖包,包括,使用新的 vscode-test 编写单元测试

    "@types/vscode": "^1.45.0",
    "vscode-test": "^1.3.0",
  2. 使用 Gulp 重写了 Compile 流程,以方便不同平台下复制 src/config 到 out 文件夹

  3. 增加了新的命令 npm run sync, 将会自动分析安装至 npm 的 ant-design-vue 文件中和 types文件,自动生成 ui-tags.json , ui-attributes.js 以及 "src/config/attributes/*.json",描述和类型将自动读取 node_modules/ant-design-vue/types/*/.d.ts 的文件结构及注释。并使用这个信息生成 tags 相关内容及 attributes 的 ommit / defaultValue / types

  4. 也就是日后更新流程如下

      1. ant-design-vue 使用较规范的文档格式
      1. 修改 devDependencies 中的 ant-design-vue 及版本
      1. npm install / yarn install
      1. npm run sync 更新最新的json配置文件
      1. npm run compile 生成并复制到 out
      1. 打包或调试

另外,当前提交中的内容是自动生成自 1.5.5

tangjinzhou commented 4 years ago

ts 类型文件的注释 需要好好盘点下了 事件如何解?

chsword commented 4 years ago

@tangjinzhou 我个人觉得事件不适合以 property 的形式存在 ,可以考虑以接口方式定义事件

class Button extends AntdComponent implements OnClick{}
interface BaseAntdEvent{
}
interface OnClick extends BaseAntdEvent{
}

使用接口来定义标准行为,这样可以通过实现的接口来生成相应文档

chsword commented 4 years ago

增加了两个配置文件

./build/specialExcludeMap.ts 用于配置忽略生成的文件

./build/specialAttributesMap.ts 用于配置文件名/类名特殊的情况生成的标签

当前配置了如下规则,这个希望日后在对应类上增加 Decorator 或注释

const specialAttributesMap: Record<string, string> = {
  "a-datepicker-common": "a-date-picker",
  "mentions/a-option": "a-mentions-option",
  "meta/a-meta": "a-list-item-meta",
  "select/a-option": "a-select-option",
  "select/a-option-group": "a-select-opt-group",
  "table/a-column": "a-table-column",
  "table/a-column-group": "a-table-column-group",
  "a-tooltip-common": "a-tooltip",
};

另外解决了 layout 的类生成tags错误的Bug