1.2.0 • Published 9 months ago

option2meta v1.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

TOC

描述

根据option.json生成对应的meta.js文件

安装依赖【开发】

pnpm i --registry=https://registry.npmjs.org

版本要求

  • node >= 16.16.0

功能

输出包版本信息 -v --version

执行:

o2m -v
o2m --version

输出帮助信息 -h --help

o2m -h
o2m --help

配置编译 -b --build

o2m -b configPath
o2m --build configPath

注意,这里接收参数configPath,它是一个绝对文件路径,比如:

o2m --build ./test/configs/.o2m.config.json

处理json文件,还支持js文件:

o2m --build ./test/configs/.o2m.config.js

配置

下面说一下文件配置,以js文件为例:

module.exports = {
    //是否格式化
    "format": false,
    //配置路径
    "optionPath": "../options/option.js", //支持.js .json .xlsx .xls
    //meta.ts文件生成路径
    "metaPath": "../metas/meta.ts",
    //模板文件路径
    "templatePath": "../templates/template.ts",
    //通过接口处理
    "url": 'http://www.example.com/function/importmaterial',
    //组件名称--可选,默认BizFormInput
    "componentName":"TestComponent",
}

下面依此说明每个配置的意义:

后续支持的功能

  1. 根据excel文件生成配置
  2. 支持通过接口获取json