Files
wiki/scripts/send-newsletter-stats.ts
Wayne Sutton a87db9d171 docs: add changelog entries for v1.33.1 through v1.37.0
Add missing changelog entries to content/pages/changelog-page.md:

v1.34.0 (2025-12-26): Blog page featured layout with hero post
- blogFeatured frontmatter field for posts
- Hero card displays first featured post with landscape image
- 2-column featured row for remaining featured posts
- 3-column grid for regular posts

v1.35.0 (2025-12-26): Image support at top of posts and pages
- showImageAtTop frontmatter field
- Full-width image display above post header
- Works for both posts and pages

v1.36.0 (2025-12-27): Social footer component
- Customizable social links (8 platform types)
- Copyright with auto-updating year
- showSocialFooter frontmatter field for per-page control
- Configurable via siteConfig.socialFooter

v1.37.0 (2025-12-27): Newsletter Admin UI
- Three-column admin interface at /newsletter-admin
- Subscriber management with search and filters
- Send newsletter panel (post selection or custom email)
- Weekly digest automation (Sunday 9am UTC)
- Developer notifications (subscriber alerts, weekly stats)
- Markdown-to-HTML conversion for custom emails
2025-12-27 15:32:07 -08:00

64 lines
1.7 KiB
TypeScript

#!/usr/bin/env npx ts-node
/**
* Send weekly stats summary email to developer
*
* Usage:
* npm run newsletter:send:stats
*
* Environment variables (from .env.local):
* - VITE_CONVEX_URL: Convex deployment URL
* - SITE_NAME: Your site name (default: "Newsletter")
*
* Note: AGENTMAIL_API_KEY, AGENTMAIL_INBOX, and AGENTMAIL_CONTACT_EMAIL must be set in Convex dashboard
*/
import { ConvexHttpClient } from "convex/browser";
import { api } from "../convex/_generated/api";
import dotenv from "dotenv";
// Load environment variables
dotenv.config({ path: ".env.local" });
dotenv.config({ path: ".env.production.local" });
async function main() {
const convexUrl = process.env.VITE_CONVEX_URL;
if (!convexUrl) {
console.error(
"Error: VITE_CONVEX_URL not found. Run 'npx convex dev' to create .env.local"
);
process.exit(1);
}
const siteName = process.env.SITE_NAME || "Newsletter";
console.log("Sending weekly stats summary...");
console.log(`Site name: ${siteName}`);
console.log("");
const client = new ConvexHttpClient(convexUrl);
try {
// Call the mutation to schedule the stats summary send
const result = await client.mutation(api.newsletter.scheduleSendStatsSummary, {
siteName,
});
if (result.success) {
console.log("✓ Stats summary scheduled successfully!");
console.log(result.message);
console.log("");
console.log("The email will be sent to AGENTMAIL_INBOX (or AGENTMAIL_CONTACT_EMAIL if set).");
} else {
console.error("✗ Failed to send stats summary:");
console.error(result.message);
process.exit(1);
}
} catch (error) {
console.error("Error:", error);
process.exit(1);
}
}
main();