0.16.2 • Published 2 years ago

dingtalk-worktab-plugin-script v0.16.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

README

使用说明

命令行模式

node node_modules/.bin/dingtalk-worktab-plugin-script -d ./demo -c ./rc.json -t 1

bundle模式

import validate from './bundle';

validate('./demo')
    .then((res) => {
        const { result, data, } = res;
        // result是boolean,表示是否有错误
        // data是string,校验得到的报告
    });
    
    
const customRcJson = {...}
validate('./demo', customRcJson)
    .then((res) => {
        const { result, data, } = res;
    });

代码说明

src/index.ts 是命令行的主文件

src/bundle.ts 是bundle模式的主文件

运行以下命令,可以打印出开发阶段需要的console信息

tnpm run build-test

js ast 调试

src/js/parse.ts 中把注释代码开起来,就会在本地的tmp/jsAst文件中输出 demo/components/statistical-indicator-view/index.js 文件的 ast 结构。

因此建议将demo/components/statistical-indicator-view/index.js文件作为js语法的测试文件。

新增validator

在src/validators文件夹下仿照其他的validator(如acss、js、configJson等)增加即可。但要注意在src/validators/init.ts文件中注册一下新增的validator。

talk is cheep, see code!