@tbuilder/core
v0.0.18
Published
DSL parser,compiler,generator and more base power package
Downloads
7
Readme
@tbuilder/core
tBuilder是一个通过DSL来自动快速生成前端项目的编译器,提供通过同一份DSL编译到不同目标平台(vue,h5,小程序等)的能力
核心库安装
npm i @tbuilder/core
核心库使用
import TBuilder from '@tbuilder/core'
const builder = new TBuilder(finalPath)
builder.compile()
builder.generate()
TBuilder类
| 方法 | 参数 | 说明 | | - | - | - | | new(dsl: string | object) | dsl: dsl文件路径或dsl对象 | 创建实例 | | compile() : tBuilderAST | - | 返回通过dsl解析生成的AST | | generate() : Promise | - | 通过DSL创建前端项目 |
tBuilder DSL
{
"project": {
"name": "测试项目",
"version": "0.0.1",
"description": "一个测试用的项目",
"author": "tBuilder",
"compileTarget": "vue",
"uiLib": "iView",
"dist": "/Users/inlost/Downloads/tBuilder"
},
"pages": [{
"name": "test page",
"route": "/test",
"components": [{
"name": "Card",
"props": [{
"key": "bordered",
"value": false
}, {
"key": "shadow",
"value": true
}],
"children": [{
"name": "p",
"props": [{
"key": "slot",
"value": "title"
}],
"content": "No border title"
}, {
"name": "p",
"content": "Content of no border type. Content of no border type. Content of no border type. Content of no border type."
}],
"content": "test content"
}]
}],
"dataModules": [{
"name": "test module",
"apis": [{
"name": "test api1",
"path": "/api/test/api1",
"method": "GET",
"share": true,
"has_param": true
}, {
"name": "test api2",
"path": "/api/test/api2",
"method": "POST",
"share": false,
"has_param": false
}]
}, {
"name": "test test module",
"apis": [{
"name": "test api3",
"path": "/api/test/api3",
"method": "POST",
"share": true,
"has_param": true
}]
}]
}
tBuilder cli
生成项目的命令行工具
插件扩展
TODO
Generated by tmaker.