Commit 90d4335
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
- pages
- tag
- tool
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments