Skip to content

Commit 931e30d

Browse files
authored
Merge pull request #238 from desci-labs/prefetch
add prefetch feature
2 parents 451fb88 + 7dea4d4 commit 931e30d

File tree

7 files changed

+13799
-70
lines changed

7 files changed

+13799
-70
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,9 @@ npm-debug.log*
2222
# Archive directory for article downloads and metadata
2323
/archive
2424

25+
# Cache directory for prefetched article data
26+
# Run `pnpm run prefetch` to populate
27+
/cache
28+
2529
.astro/
2630
.playwright-mcp

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,57 @@ The unique characteristics of the Insight Journal include:
88
- Open-access to articles, data, code, and reviews
99
- Open peer-review that invites discussion between reviewers and authors
1010
- Support for continuous revision of articles, code, and reviews
11-
- Sustainable, reproducible research via Web3 technologies and the principles of verifiability, decentralization, and incentive engineering
11+
- Sustainable, reproducible research via Web3 technologies and the principles of verifiability, decentralization, and incentive engineering
12+
13+
## Development
14+
15+
### Prerequisites
16+
17+
- Node.js 20+
18+
- pnpm
19+
20+
### Installation
21+
22+
```bash
23+
pnpm install
24+
```
25+
26+
### Build Commands
27+
28+
| Command | Description |
29+
|---------|-------------|
30+
| `pnpm run dev` | Start development server |
31+
| `pnpm run build` | Build site (uses cache if available, network fallback) |
32+
| `pnpm run build:full` | Prefetch all articles then build (recommended for production) |
33+
| `pnpm run preview` | Preview production build |
34+
35+
### Prefetch System
36+
37+
The site uses a cache-first architecture for robust, offline-capable builds. Articles are prefetched from the DeSci network and cached locally.
38+
39+
```bash
40+
# Prefetch all articles (skips already cached)
41+
pnpm run prefetch
42+
43+
# Force re-fetch all articles
44+
pnpm run prefetch:force
45+
46+
# Verbose output with detailed logging
47+
pnpm run prefetch:verbose
48+
```
49+
50+
**Cache location:** `./cache/`
51+
- `cache/myst/` - Article JSON data
52+
- `cache/pdfs/` - PDF files
53+
- `cache/downloads/` - Download manifests
54+
- `cache/thumbnails/` - Article thumbnails
55+
56+
The prefetch script includes:
57+
- Exponential backoff with jitter (1s → 30s max)
58+
- Up to 5 retries per request
59+
- Detailed error codes (E100-E999) for debugging
60+
- Concurrent fetching (4 parallel requests)
61+
62+
### Dependency Notes
63+
64+
The `pnpm.overrides` in `package.json` forces katex to v0.16.27 to fix an ESM compatibility issue with the older version bundled in myst-transforms.

0 commit comments

Comments
 (0)