1 Star 0 Fork 2

snow4aa001/CasaOS-UI

forked from IceWhale Team/CasaOS-UI 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
message_bus.build.js 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
zhanghengxin 提交于 2023-01-04 11:41 . :construction:Work in progress.
/*
* @LastEditors: zhanghengxin ezreal.zhang@icewhale.org
* @LastEditTime: 2023/1/3 下午8:51
* @FilePath: /CasaOS-UI/message_bus.build.js
* @Description:
*
* Copyright (c) 2022 by IceWhale, All Rights Reserved.
*/
const events = require('./src/events/message_bus.js');
const fs = require('fs');
const path = require('path');
const outPath = './build/sysroot/var/lib/casaos/';
const outName = 'ui-message-bus.json';
const registerShellPath = './build/sysroot/etc/casaos/start.d/';
var array = [];
// Parse the event to array
Object.keys(events).forEach((key) => {
events[key]().then(eventObj => {
eventObj.propertyTypeList = Object.keys(eventObj.properties)
eventObj.propertyTypeList = eventObj.propertyTypeList.map((key) => {
return {
"name": key,
"discription": "",
"example": ""
}
});
delete eventObj.properties
array.push(eventObj);
});
});
// Create the output folder
fs.mkdir(outPath, {recursive: true}, (err) => {
if (err) {
console.log(err);
} else {
// Write the output file
fs.writeFile(path.join(outPath, outName), JSON.stringify(array, "", "\t"), (err) => {
if (err) {
console.log(err);
} else {
console.log('The json file has been saved!');
}
});
}
});
// Copy the register shell file to the output folder
fs.mkdir(registerShellPath, {recursive: true}, (err) => {
if (err) {
console.log(err);
} else {
fs.copyFile('./register-ui-events.sh', path.join(registerShellPath, 'register-ui-events.sh'), (err) => {
if (err) {
console.log(err);
} else {
console.log('The shell file has been saved!');
}
});
}
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/snow4aa001/CasaOS-UI.git
git@gitee.com:snow4aa001/CasaOS-UI.git
snow4aa001
CasaOS-UI
CasaOS-UI
main

搜索帮助