This project is dedicated to collecting high-quality macOS software and organizing them systematically by different categories for easy search and use.
Dockerfile appappleapplicationappsawesomeawesome-listawesome-macdesktop-appdesktop-applicationdesktop-appslistmacmac-osxmacosmacos-appmacos-appsmacosxsoftwareswiftswiftui
chore: update feed script.
小弟调调90def6b675d3
diff --git a/build/feed.mjs b/build/feed.mjsindex 8d8351c1..158a1c2a 100644--- a/build/feed.mjs+++ b/build/feed.mjs@@ -63,6 +63,7 @@ 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.@@ -109,7 +110,10 @@ function generateFeedForTarget(target) {limit: feedItemLimit,logPrefix: target.readmePath,});- const feedItems = mergeFeedItems(newItems, existingFeed.items, feedItemLimit);+ const feedItems = refreshFeedItemsFromCurrentReadme(+ mergeFeedItems(newItems, existingFeed.items, feedItemLimit),+ target.readmePath,+ );console.log(`[feed] ${target.readmePath}: identified ${newItems.length} new apps from ${commitsToProcess.length} processed commits`,@@ -259,7 +263,7 @@ function extractNewAppsFromCommit(commit, readmePath) {// Parse one added or removed README bullet line into a structured app record.function parseDiffAppLine(line, sign) {- const escaped = sign === '+' ? '\\+' : '-';+ const escaped = sign ? (sign === '+' ? '\\+' : '-') : '';// README app entries consistently use:// * [App Name](url) - Description@@ -341,7 +345,7 @@ function loadExistingFeed(target) {try {const xml = readFileSync(outputPath, 'utf8');- const items = parseFeedItemsFromXml(xml);+ const items = refreshFeedItemsFromCurrentReadme(parseFeedItemsFromXml(xml), target.readmePath);return {latestCommitHash: items[0]?.commitHash || '',items,@@ -352,6 +356,66 @@ 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) || [];@@ -596,12 +660,22 @@ function escapeXml(value) {// Decode escaped XML entities when reading existing feed items back from XML.function decodeXml(value) {- return String(value)- .replace(/'/g, "'")- .replace(/"/g, '"')- .replace(/>/g, '>')- .replace(/</g, '<')- .replace(/&/g, '&');+ let decoded = String(value);++ while (true) {+ const next = decoded+ .replace(/'/g, "'")+ .replace(/"/g, '"')+ .replace(/>/g, '>')+ .replace(/</g, '<')+ .replace(/&/g, '&');++ if (next === decoded) {+ return next;+ }++ decoded = next;+ }}// Remove a CDATA wrapper when reading XML fields that intentionally contain HTML.