1 Star 2 Fork 0

云乐龙仔/sword-laboratory

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
readme_build.js 1023 Bytes
一键复制 编辑 原始数据 按行查看 历史
云乐龙仔 提交于 2023-07-14 15:00 . 目录自述机制完成
let readmeText = "# 目录说明\r";
let rootPath = ".";
let ignoredDirectories = [".git",".idea",".vscode",".settings"]
async function buildCatalog(path,depth) {
for await (const dirEntry of Deno.readDir(path)) {
if (!dirEntry.isDirectory) {
continue
}
let dirName = dirEntry.name;
if (ignoredDirectories.includes(dirName)) {
continue
}
let dirPath = path + '/' + dirName;
let catalogDescription;
try {
catalogDescription = JSON.parse(await Deno.readTextFile( dirPath + "/catalog_description.json"))
} catch (e) {
if (e.name !== 'NotFound') {
console.error(e)
}
}
for (let i = 0; i < depth; i++) {
readmeText += ' '
}
readmeText += `- [${dirName}](${dirPath})${catalogDescription?.description ? `【${catalogDescription.description}】` : ''}\r`
if (catalogDescription?.hasSubordinate) {
await buildCatalog(dirPath,depth+1)
}
}
}
await buildCatalog(rootPath,0)
Deno.writeTextFileSync("README.md",readmeText)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/bluesword12350/sword-laboratory.git
git@gitee.com:bluesword12350/sword-laboratory.git
bluesword12350
sword-laboratory
sword-laboratory
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385