docs: add npm run sync:prod notes for production

Clarify when to use development vs production sync commands
in setup-guide, about-this-blog, and markdown-with-code-examples
This commit is contained in:
Wayne Sutton
2025-12-15 09:25:42 -08:00
parent 6c10829b1c
commit b280cb4605
8 changed files with 60 additions and 16 deletions

View File

@@ -104,6 +104,7 @@ export const getStats = query({
uniqueVisitors: v.number(),
publishedPosts: v.number(),
publishedPages: v.number(),
trackingSince: v.union(v.number(), v.null()),
pageStats: v.array(
v.object({
path: v.string(),
@@ -133,8 +134,15 @@ export const getStats = query({
.map(([path, count]) => ({ path, count }))
.sort((a, b) => b.count - a.count);
// Get all page views
const allViews = await ctx.db.query("pageViews").collect();
// Get all page views ordered by timestamp to find earliest
const allViews = await ctx.db
.query("pageViews")
.withIndex("by_timestamp")
.order("asc")
.collect();
// Get tracking start date (earliest view timestamp)
const trackingSince = allViews.length > 0 ? allViews[0].timestamp : null;
// Aggregate views by path and count unique sessions
const viewsByPath: Record<string, number> = {};
@@ -197,6 +205,7 @@ export const getStats = query({
uniqueVisitors: uniqueSessions.size,
publishedPosts: posts.length,
publishedPages: pages.length,
trackingSince,
pageStats,
};
},