Skip to content

Commit 79af1ea

Browse files
committed
chore: add premium newsletter content and submodule setup
1 parent dc390f1 commit 79af1ea

10 files changed

Lines changed: 50 additions & 230 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "apps/web/src/content/newsletters-premium"]
2+
path = apps/web/src/content/newsletters-premium
3+
url = git@github.com:apsinghdev/opensox-newsletters-premium.git

apps/web/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ yarn-error.log*
3838
# typescript
3939
*.tsbuildinfo
4040
next-env.d.ts
41+
42+
src/content/newsletters-premium/

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7-
"build": "next build",
7+
"build": "bash ./scripts/init-submodules.sh && next build",
88
"start": "next start",
99
"lint": "next lint"
1010
},
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# initialize git submodules during vercel build
3+
4+
# setup ssh for private submodule
5+
if [ -n "$GIT_SSH_KEY" ]; then
6+
mkdir -p ~/.ssh
7+
echo "$GIT_SSH_KEY" > ~/.ssh/id_ed25519
8+
chmod 600 ~/.ssh/id_ed25519
9+
ssh-keyscan github.com >> ~/.ssh/known_hosts
10+
fi
11+
12+
# initialize and update submodules
13+
git submodule update --init --recursive --remote
14+
15+
echo "submodules initialized successfully"
16+

apps/web/src/app/api/newsletters/[slug]/route.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ marked.setOptions({
1616
// Cache individual newsletters
1717
const newsletterCache = new Map<string, { data: any; time: number }>();
1818
// cache longer in production since newsletter content changes infrequently
19-
const CACHE_DURATION =
20-
process.env.NODE_ENV === "production"
21-
? 3600000
22-
: 60000;
19+
const CACHE_DURATION = process.env.NODE_ENV === "production" ? 3600000 : 60000;
2320

2421
export async function GET(
2522
_request: Request,
@@ -64,7 +61,11 @@ export async function GET(
6461
return NextResponse.json(cached.data);
6562
}
6663

67-
const newslettersDir = path.join(process.cwd(), "src/content/newsletters");
64+
// read from premium directory for paid users
65+
const newslettersDir = path.join(
66+
process.cwd(),
67+
"apps/web/src/content/newsletters-premium"
68+
);
6869
const filePath = path.join(newslettersDir, `${slug}.md`);
6970

7071
try {

apps/web/src/app/api/newsletters/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export async function GET() {
5454
return NextResponse.json(cachedNewsletters);
5555
}
5656

57-
const newslettersDir = path.join(process.cwd(), "src/content/newsletters");
57+
// read from premium directory for paid users
58+
const newslettersDir = path.join(
59+
process.cwd(),
60+
"apps/web/src/content/newsletters-premium"
61+
);
5862

5963
try {
6064
if (!fs.existsSync(newslettersDir)) {
Submodule newsletters-premium added at 0f49f26

apps/web/src/content/newsletters/2024-01-welcome.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,21 @@ We're thrilled to have you here! **Opensox AI** is designed to transform how dev
2727

2828
Connect with thousands of developers on our [Discord server](https://discord.gg/37ke8rYnRM) and share your journey.
2929

30+
---
31+
32+
## Want More?
33+
34+
This is a free sample newsletter. **Premium subscribers** get exclusive access to:
35+
36+
- 📰 **Weekly Curated Insights** on open-source jobs and opportunities
37+
- 💰 **Funding News** and investment trends in the OSS ecosystem
38+
- 🚀 **Trending Projects** before they go viral
39+
- 💡 **Expert Tips** from maintainers and core contributors
40+
- 📊 **Industry Analysis** and deep dives into OSS trends
41+
42+
[**Upgrade to Premium**](/pricing) to unlock the full newsletter archive and stay ahead in the open-source world.
43+
44+
---
45+
3046
**Happy Contributing!**
3147
The Opensox Team

apps/web/src/content/newsletters/2024-02-new-features.md

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

apps/web/src/content/newsletters/2024-03-success-stories.md

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

0 commit comments

Comments
 (0)