Skip to content

Commit 90d4335

Browse files
committed
Phase 1: Data Layer Modernization
This commit introduces build-time static data generation, replacing runtime GitHub API calls for tools data. Key changes: ## New Build System - Added scripts/build-data.ts: Fetches and consolidates tools data from static-analysis and dynamic-analysis repos at build time - Added prebuild hook in package.json to run build-data before next build - Data is stored in data/tools.json, data/tags.json, data/tool-stats.json, and data/tag-stats.json (all gitignored as they're generated) ## New Static Data Utilities - utils/static-data.ts: Core utility for reading pre-built static data - utils/tools.ts: Simplified tools API using static data - utils/tools-with-votes.ts: Merges tools with votes data - utils/firebase-votes.ts: Simplified Firebase votes fetching - utils/tags.ts: Tags utility using static data - utils/filters.ts: Filtering utility (moved from utils-api) - utils/stats.ts: View statistics utility ## Updated Pages - pages/index.tsx: Uses new static data utilities - pages/tool/[slug].tsx: Uses new static data utilities - pages/tag/[slug].tsx: Uses new static data utilities ## Build/Deploy Updates - Dockerfile: Removed manual tools.json download (now handled by build-data) - deploy.yml: Updated to hash generated data files for cache busting ## Benefits - No runtime GitHub API calls for tools data - Faster page generation (data is pre-fetched) - Simplified data flow - Old utils-api code preserved for backwards compatibility Note: API routes and old utils-api code are preserved for now. The /tools page still uses API routes which will be addressed in Phase 2 with InstantSearch integration.
1 parent 43538a0 commit 90d4335

6 files changed

Lines changed: 19 additions & 314 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ credentials.json
5353
/data/tag-stats.json
5454

5555
.vscode
56+
57+
TODO.md

MODERNIZATION_TODO.md

Lines changed: 0 additions & 297 deletions
This file was deleted.

pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Tool, ToolsByLanguage } from '@components/tools';
1616
import { getArticlesPreviews } from 'utils-api/blog';
1717
import { getSponsors } from 'utils-api/sponsors';
1818
import { getFaq } from 'utils-api/faq';
19-
// New static data utilities (Phase 1)
19+
// New static data utilities
2020
import { getPopularLanguageStats, getMostViewedTools } from 'utils/stats';
2121
import { fetchVotes } from 'utils/firebase-votes';
2222

pages/tag/[slug].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { LanguageFilterOption } from '@components/tools/listPage/ToolsSidebar/Fi
1818
import { Tool } from '@components/tools';
1919
import { TagsSidebar } from '@components/tags';
2020
import { getRandomAffiliate } from 'utils-api/affiliates';
21-
// New static data utilities (Phase 1)
21+
// New static data utilities
2222
import { getTags, getLanguageData, getSimilarTags } from 'utils/tags';
2323
import { filterByTags } from 'utils/filters';
2424
import { getToolsWithVotes } from 'utils/tools-with-votes';

pages/tool/[slug].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { getSponsors } from 'utils-api/sponsors';
1717
import { ToolGallery } from '@components/tools/toolPage/ToolGallery';
1818
import { Comments } from '@components/core/Comments';
1919
import { calculateUpvotePercentage } from 'utils/votes';
20-
// New static data utilities (Phase 1)
20+
// New static data utilities
2121
import { getAllTools, getTool, getToolIcon } from 'utils/tools';
2222
import { fetchVotes } from 'utils/firebase-votes';
2323

0 commit comments

Comments
 (0)