jr 常量生成
/**
* 1.常量必选以Enum结尾
* 2.必选添加如例子里的注释才会生成
* 3.可只对需要生成的内容做注释
*/
export enum AdminTypeEnum {
/** 超级管理员 */
superAdmin = 1,
/** 普通管理员 */
generalAdmin = 0,
}
编译
/**
* 1.工作区中新增jr-tools.config.js文件
*/
module.exports = {
// 编译新增配置选项
flatBuildPrompts: [
// 自定义的
{
label: '听说我是例子', // 显示名称
checked: true, // 默认勾选状态
key: 'test', // 关键词,用于在hook中匹配排序使用
// 简单的commands语句组
commands: [`echo 我是例子!`],
},
],
/**
* ````
* key:
* 1.command_before 执行命令之前
* ````
* ````
* data:
{
commands: {[key:string]: string[]}
commandSort: string[];
abilitys: {[key:string]: boolean}
buildUris: {
key: string;
title: string;
entry: string;
}[];
keys: any[];
titles: any[];
}
* ````
*/
flatBuildHook(key, data, log) {
log([key, data]);
if(data.abilitys.test) {
data.commands.test.push('echo 听说我,我也是测试!')
}
return data;
},
};
模块创建
| |