代码拉取完成,页面将自动刷新
const path = require("path")
const fs = require("fs")
var SCAN_PATH = path.join(__dirname)
// var GIT_URL = "http://ui-dna.doc.design-enzyme.com"
var GIT_URL = "http://doc.design-enzyme.com"
var NOTSCAN = /^.git/
fileList = []
console.info("\x1b[94m", "扫描目录----------------------------", SCAN_PATH)
scanDir(SCAN_PATH)
function scanDir(inPath) {
var dir = fs.readdirSync(inPath)
for (x in dir) {
if (NOTSCAN.test(dir[x])) {
console.log("skip ", dir[x])
continue;
}
var _thisPath = path.join(inPath, dir[x])
var isDirectory = false
try {
var stat = fs.statSync(_thisPath)
isDirectory = stat.isDirectory()
} catch (e) {
console.error(e)
}
if (isDirectory) {
scanDir(_thisPath)
} else {
console.log("+", _thisPath)
var filename = path.relative(SCAN_PATH, _thisPath)
var filename = filename.replace(/\@/g, "%40").replace(/\\/g, "/")
fileList.push({url:"http://nullice.oschina.io/ui-dna-cn/"+filename, name:path.relative(SCAN_PATH, _thisPath)})
}
}
}
console.log(fileList)
var html ="<html>"
for(var x in fileList)
{
html+= `<br><a href="${fileList[x].url}" traget="_blank"> ${fileList[x].url}</a>\n`
}
console.log(html)
fs.writeFileSync(path.join(__dirname,"index.html"), html)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。