| 40 | const { prefix, children } = sideBarData |
| 41 | |
| 42 | async function quickCreateMdFile() { |
| 43 | /** |
| 44 | * 第一步: 创建目录 |
| 45 | */ |
| 46 | const dir = VipNodeJS.pathJoin(__dirname, prefix) |
| 47 | const isExist = VipNodeJS.existPath(dir) |
| 48 | |
| 49 | if (!isExist) { |
| 50 | await fs.mkdirSync(dir) |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * 第二步: 创建文件,并追加文件内容 |
| 55 | */ |
| 56 | |
| 57 | for (const { text, link } of children) { |
| 58 | const filePath = VipNodeJS.pathJoin(dir, link) |
| 59 | const isExistFile = VipNodeJS.existPath(filePath) |
| 60 | // 创建 |
| 61 | if (!isExistFile) { |
| 62 | await VipNodeJS.writeFileByUTF8(filePath, `# ${text} \n\n努力赶稿中,等等我呀...`) |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void quickCreateMdFile() |