Skip to content

 This project is dedicated to collecting high-quality macOS software and organizing them systematically by different categories for easy search and use.

chore: Limit feed updates to new additions only

小弟调调f7fd4d2805a7
diff --git a/build/feed.mjs b/build/feed.mjs
index 158a1c2a..35bf6d6c 100644
--- a/build/feed.mjs
+++ b/build/feed.mjs
@@ -63,7 +63,6 @@ const FEED_TARGETS = [
mkdirSync(feedDir, { recursive: true });
const sectionMapCache = new Map();
-const currentReadmeEntryCache = new Map();
const reports = FEED_TARGETS.map(generateFeedForTarget);
// Older runs generated /feed.xml in the repository root and later in /dist.
@@ -110,10 +109,7 @@ function generateFeedForTarget(target) {
limit: feedItemLimit,
logPrefix: target.readmePath,
});
- const feedItems = refreshFeedItemsFromCurrentReadme(
- mergeFeedItems(newItems, existingFeed.items, feedItemLimit),
- target.readmePath,
- );
+ const feedItems = mergeFeedItems(newItems, existingFeed.items, feedItemLimit);
console.log(
`[feed] ${target.readmePath}: identified ${newItems.length} new apps from ${commitsToProcess.length} processed commits`,
@@ -345,7 +341,7 @@ function loadExistingFeed(target) {
try {
const xml = readFileSync(outputPath, 'utf8');
- const items = refreshFeedItemsFromCurrentReadme(parseFeedItemsFromXml(xml), target.readmePath);
+ const items = parseFeedItemsFromXml(xml);
return {
latestCommitHash: items[0]?.commitHash || '',
items,
@@ -356,66 +352,6 @@ function loadExistingFeed(target) {
}
}
-// Reconcile persisted feed items with the latest README text so description fixes propagate.
-function refreshFeedItemsFromCurrentReadme(items, readmePath) {
- const currentEntries = getCurrentReadmeEntries(readmePath);
-
- return items.map((item) => {
- const current = currentEntries.get(item.name);
- if (!current) return item;
-
- return {
- ...item,
- url: current.url,
- description: current.description,
- category: current.category,
- websiteUrl: current.websiteUrl,
- sourceUrl: current.sourceUrl,
- appStoreUrl: current.appStoreUrl,
- };
- });
-}
-
-// Parse the current README file into a lookup table keyed by app name.
-function getCurrentReadmeEntries(readmePath) {
- if (currentReadmeEntryCache.has(readmePath)) {
- return currentReadmeEntryCache.get(readmePath);
- }
-
- const content = readFileSync(resolve(repoRoot, readmePath), 'utf8');
- const entries = new Map();
- let currentSection = '';
- let currentSubsection = '';
-
- for (const line of content.split('\n')) {
- const sectionMatch = line.match(/^##\s+(.+)$/);
- if (sectionMatch) {
- currentSection = sectionMatch[1].trim();
- currentSubsection = '';
- continue;
- }
-
- const subsectionMatch = line.match(/^###\s+(.+)$/);
- if (subsectionMatch) {
- currentSubsection = subsectionMatch[1].trim();
- continue;
- }
-
- const entry = parseDiffAppLine(line, '');
- if (!entry) continue;
-
- entries.set(entry.name, {
- ...entry,
- category: currentSubsection
- ? `${currentSection} / ${currentSubsection}`
- : currentSection || 'Uncategorized',
- });
- }
-
- currentReadmeEntryCache.set(readmePath, entries);
- return entries;
-}
-
// Parse the current XML feed back into structured items for incremental updates.
function parseFeedItemsFromXml(xml) {
const itemMatches = xml.match(/<item>[\s\S]*?<\/item>/g) || [];