diff --git a/.github/scripts/create-rss.mjs b/.github/scripts/create-rss.mjs index bacdb66..0faf331 100644 --- a/.github/scripts/create-rss.mjs +++ b/.github/scripts/create-rss.mjs @@ -51,7 +51,7 @@ function getYearAndWeek(date) { const { year, week } = getYearAndWeek(new Date(issueDate)); /** 根据年份和周数生成文件名称,如 2024-01.json */ -const rssFilePath = `./docs/rss/${year}-${week}.json`; +const rssFilePath = `./feeds/rss/${year}-${week}.json`; ;(async () => { // 读取 rssFilePath 文件内容,如果文件不存在创建它并则返回空数组 @@ -60,7 +60,7 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; const bannerImage = issueBody.match(/!\[.*?\]\((.*?)\)/); try { - await fs.ensureDir('./docs/rss'); + await fs.ensureDir('./feeds/rss'); if (fs.existsSync(rssFilePath)) { rss = await fs.readJSON(rssFilePath); } @@ -99,7 +99,7 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; // 输出写入成功日志 info(`RSS 文件写入成功:${rssFilePath}`); - const oldRss = await fs.readJSON('./docs/old.json'); + const oldRss = await fs.readJSON('./feeds/old.json'); // oldRss.items 和 rss.items 合并 // 新的 newItems 根据时间排序,通过id 去重 let rssItems = oldRss.concat(rss) @@ -110,8 +110,8 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; index === self.findIndex((t) => t.id === item.id) ); - await fs.writeJSON('./docs/old.json', uniqueArray, { spaces: 2 }); - info(`Old RSS 文件写入成功:./docs/old.json`); + await fs.writeJSON('./feeds/old.json', uniqueArray, { spaces: 2 }); + info(`Old RSS 文件写入成功:./feeds/old.json`); const feed = new Feed({ title: "Quick RSS Feed", @@ -156,22 +156,22 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; }) }) - const markdownContent = fs.readFileSync('./docs/feed.md', 'utf-8'); + const markdownContent = fs.readFileSync('./feeds/feed.md', 'utf-8'); // const contentx = markdownContent.replace(/[\s\S]*/g, `\n${mdListContent}\n`); - fs.writeFileSync('./docs/feed.md', contentx); + fs.writeFileSync('./feeds/feed.md', contentx); // 输出写入成功日志 - info(`feed.md 文件写入成功:./docs/feed.md`); + info(`feed.md 文件写入成功:./feeds/feed.md`); - const jsonFeedPath = './docs/feed.json'; + const jsonFeedPath = './feeds/feed.json'; await fs.writeFile(jsonFeedPath, feed.json1()); info(`JSON Feed 文件写入成功:${jsonFeedPath}`); - const atom1FeedPath = './docs/feed.xml'; + const atom1FeedPath = './feeds/feed.xml'; await fs.writeFile(atom1FeedPath, feed.atom1()); info(`Atom1 Feed 文件写入成功:${atom1FeedPath}`); - const rss2FeedPath = './docs/rss.xml'; + const rss2FeedPath = './feeds/rss.xml'; await fs.writeFile(rss2FeedPath, feed.rss2()); info(`RSS2 Feed 文件写入成功:${rss2FeedPath}`); diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3ac3e0a..580480e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,7 +59,7 @@ jobs: - terms-of-service.zh.md - privacy-policy.md - privacy-policy.zh.md - - docs/feed.md + - feeds/feed.md footer: | Terms of ServicePrivacy Policy • @@ -72,8 +72,8 @@ jobs: - run: npm install idoc@1 -g - run: idoc - run: | - cp -rp docs/*.json dist/ - cp -rp docs/*.xml dist/ + cp -rp feeds/*.json dist/ + cp -rp feeds/*.xml dist/ - name: Deploy uses: peaceiris/actions-gh-pages@v4 diff --git a/docs/README.md b/docs/README.md deleted file mode 120000 index fd8493b..0000000 --- a/docs/README.md +++ /dev/null @@ -1 +0,0 @@ -docs/feed.md \ No newline at end of file diff --git a/feeds/README.md b/feeds/README.md new file mode 120000 index 0000000..a5d507f --- /dev/null +++ b/feeds/README.md @@ -0,0 +1 @@ +feeds/feed.md \ No newline at end of file diff --git a/docs/feed.json b/feeds/feed.json similarity index 100% rename from docs/feed.json rename to feeds/feed.json diff --git a/docs/feed.md b/feeds/feed.md similarity index 100% rename from docs/feed.md rename to feeds/feed.md diff --git a/docs/feed.xml b/feeds/feed.xml similarity index 100% rename from docs/feed.xml rename to feeds/feed.xml diff --git a/docs/old.json b/feeds/old.json similarity index 100% rename from docs/old.json rename to feeds/old.json diff --git a/docs/rss.xml b/feeds/rss.xml similarity index 100% rename from docs/rss.xml rename to feeds/rss.xml diff --git a/docs/rss/2024-38.json b/feeds/rss/2024-38.json similarity index 100% rename from docs/rss/2024-38.json rename to feeds/rss/2024-38.json