13 Star 72 Fork 79

金合科技/金合技术中台Web端

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
create-forder.js 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
LAPTOP-3PBLAHI8\8067 提交于 2024-04-16 18:14 +08:00 . 修复已知bug
/*
* @Author : wfl
* @LastEditors : wfl
* @description :
* @updateInfo :
* @Date : 2024-03-19 18:06:22
* @LastEditTime : 2024-03-19 19:14:57
*/
import fs from 'node:fs'
import path from 'node:path'
import picocolors from 'picocolors'
const { green } = picocolors
function readDir(dirPath, parentName = '') {
const stats = fs.statSync(dirPath)
const name = path.basename(dirPath)
const fullName = parentName ? `${parentName}/${name}` : name
const node = { name: parentName ? fullName : '' }
if (stats.isDirectory()) {
node.children = fs.readdirSync(dirPath).map(child =>
readDir(path.join(dirPath, child), fullName))
}
return node
}
const structure = JSON.stringify(readDir('./main-app/views'), null, 2)
const structure2 = JSON.stringify(readDir('./micro-app/views'), null, 2)
const floder = {
'main-app': JSON.parse(structure.replaceAll('views/', '')).children,
'micro-app': JSON.parse(structure2.replaceAll('views/', '')).children,
}
fs.writeFile('main-app/folder.json', JSON.stringify(floder), 'utf8', (err) => {
if (err) { throw err }
console.info(green('Iking-Admin: [文件已更新! 请刷新页面后查看]'))
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/ikingtech/iking-platform-web.git
git@gitee.com:ikingtech/iking-platform-web.git
ikingtech
iking-platform-web
金合技术中台Web端
dev

搜索帮助