-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
summary.mjs
47 lines (41 loc) · 1.15 KB
/
summary.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import fs from "node:fs";
import util from "node:util";
// --title <title>
const options = util.parseArgs({
options: {
title: {
type: "string"
}
}
});
const title = options.values.title ?? "Summary";
const readJSON = async (path) => {
return JSON.parse(fs.readFileSync(path, "utf8"));
};
/** @type import("./src/watch-list.ts").WatchItem[] **/
const watchList = await readJSON("data/watch-list.json");
/** @type import("./src/rss-list.ts").FeedItem[] **/
const feedList = await readJSON("data/feed-list.json");
/** @type import("./src/rss-list.ts").FeedItem[] **/
const opmlList = await readJSON("data/opml-list.json");
const noHaveFeedList = watchList.filter((site) => {
return !feedList.some((feed) => {
return feed.url === site.url;
});
});
const summary = {
total: watchList.length,
feeds: feedList.length,
opmls: opmlList.length
};
console.log(`# ${title}
- total: ${summary.total}
- feeds: ${summary.feeds}
- opmls: ${summary.opmls}
<details>
<summary>No RSS list: ${noHaveFeedList.length}</summary>
${noHaveFeedList.map((site) => {
return `- <${site.url}>`;
}).join("\n")}
</details>
`);