-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/analytics-102] ✨ feat: Analytics 추가 & 시리즈 수 집계 로직 수정 #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import type { VelitePost } from "./source"; | ||
| import { getAllPosts } from "./queries"; | ||
| import { CategoryKey } from "@/config/categories"; | ||
| import { SERIES_META_BY_CATEGORY } from "@/lib/posts/registry/series.registry"; | ||
|
|
||
| export interface CategoryStatsParams { | ||
| category: CategoryKey; | ||
|
|
@@ -67,12 +68,8 @@ export function getCategoryStats(params: CategoryStatsParams): CategoryStats { | |
| const thisYYYYMM = toYYYYMM(now); | ||
| const newThisMonth = catPosts.filter((p) => p.date.startsWith(thisYYYYMM)).length; | ||
|
|
||
| const seriesSet = new Set( | ||
| catPosts | ||
| .map((p) => p.series?.trim()) | ||
| .filter((s): s is string => Boolean(s)) | ||
| ); | ||
| const seriesCount = seriesSet.size; | ||
| const seriesMeta = SERIES_META_BY_CATEGORY[category] ?? []; | ||
| const seriesCount = seriesMeta.length; | ||
|
Comment on lines
+71
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -type f -name "*.ts" -o -name "*.tsx" | grep -E "(registry|series)" | head -20Repository: swallowedB/b-log Length of output: 490 🏁 Script executed: # SERIES_META_BY_CATEGORY 정의 찾기
rg "SERIES_META_BY_CATEGORY" --type ts -B 2 -A 5Repository: swallowedB/b-log Length of output: 2900 🏁 Script executed: # stats.ts의 해당 부분 확인
cat -n src/lib/posts/stats.ts | sed -n '60,85p'Repository: swallowedB/b-log Length of output: 961 🏁 Script executed: # 레지스트리 전체 내용 확인
cat -n src/lib/posts/registry/series.registry.tsRepository: swallowedB/b-log Length of output: 1750 🏁 Script executed: # 포스트 구조에서 series 필드 확인
rg "series" src/lib/posts/source.ts -B 2 -A 2Repository: swallowedB/b-log Length of output: 42 🏁 Script executed: # 실제 포스트 파일에서 series id 사용 확인 (샘플 포스트 찾기)
fd "\.mdx?$" --max-results 10 | head -1 | xargs head -30Repository: swallowedB/b-log Length of output: 1121 🏁 Script executed: # velite 설정이나 포스트 스키마 확인
rg "series" src/lib/posts -B 2 -A 2 --type ts | head -40Repository: swallowedB/b-log Length of output: 2005 🏁 Script executed: # 포스트 저장 위치 찾기
fd -t f -e md -e mdx | head -5Repository: swallowedB/b-log Length of output: 107 🏁 Script executed: # 포스트 메타데이터 스키마 확인 (velite)
rg "schema\|collection" velite.config -A 5 -B 2 2>/dev/null || rg "export.*Post" src/lib/posts -A 10 | head -50Repository: swallowedB/b-log Length of output: 2676 🏁 Script executed: # VelitePost 타입 정의 확인
rg "VelitePost\|posts:\|collection" -A 15 | grep -A 15 "posts\|VelitePost" | head -60Repository: swallowedB/b-log Length of output: 42 🏁 Script executed: # velite.config 파일 찾기
fd "velite" -name "*.config.*" -o -name "velite.ts" -o -name "velite.js"Repository: swallowedB/b-log Length of output: 290 🏁 Script executed: # 실제 포스트 파일 확인 (frontmatter에 series 있는지)
cat content/posts/INSIGHT/velite-test.mdx | head -30Repository: swallowedB/b-log Length of output: 700 🏁 Script executed: # getSeriesByIdAndCategory 함수 확인 - 대소문자 처리 확인
rg "getSeriesBy\|seriesId" src/lib/posts -B 3 -A 8 | head -60Repository: swallowedB/b-log Length of output: 42 🏁 Script executed: # 모든 포스트에서 사용된 series 값 추출 (대소문자 확인)
rg "^series:" content/posts -h | sort | uniq -cRepository: swallowedB/b-log Length of output: 10375 🏁 Script executed: # 레지스트리의 모든 series id 확인
rg "id:" src/lib/posts/registry/series.registry.ts | grep -o '"[^"]*"' | sort | uniqRepository: swallowedB/b-log Length of output: 119 🏁 Script executed: # posts 폴더의 모든 .mdx 파일에서 series 필드 확인
find content/posts -name "*.mdx" -exec grep -h "^series:" {} \; | sort | uniq -cRepository: swallowedB/b-log Length of output: 84 🏁 Script executed: # 쿼리에서 series 필터링 로직 확인
rg "filterByS\|filterSeries\|series.*filter" src/lib/posts -B 2 -A 8Repository: swallowedB/b-log Length of output: 42 🏁 Script executed: # queries.ts에서 시리즈 필터링 로직 전체 확인
cat -n src/lib/posts/queries.ts | sed -n '1,150p'Repository: swallowedB/b-log Length of output: 2483 🏁 Script executed: # 포스트 소스 정의 및 시리즈 필드 정규화 확인
cat src/lib/posts/source.tsRepository: swallowedB/b-log Length of output: 181 🏁 Script executed: # velite config 또는 post schema 확인
fd -type f \( -name "*.config.ts" -o -name "*.config.js" \) | xargs grep -l "posts\|velite" 2>/dev/nullRepository: swallowedB/b-log Length of output: 232 🏁 Script executed: # 시리즈 관련 모든 대소문자 처리 확인
rg "toLowerCase\|toUpperCase\|series" src/lib/posts -i -B 2 -A 2 | grep -A 5 -B 5 "series"Repository: swallowedB/b-log Length of output: 42 🏁 Script executed: # velite 설정 파일 찾기
find . -name "velite.config.*" -o -name "velite.ts"Repository: swallowedB/b-log Length of output: 78 🏁 Script executed: # 포스트 schema 정의 확인 (# site prefix 찾기)
rg "#site" src -B 3 -A 3 | head -40Repository: swallowedB/b-log Length of output: 277 🏁 Script executed: # 포스트 필드 검사 (series 포함)
rg "series\|category\|draft" src/lib/posts/source.ts -B 1 -A 1Repository: swallowedB/b-log Length of output: 42 🏁 Script executed: # velite.config.ts 파일 확인
cat velite.config.tsRepository: swallowedB/b-log Length of output: 2005 🏁 Script executed: # 모든 포스트 파일에서 series 필드값 추출 (확인)
find content/posts -name "*.mdx" -exec grep -h "^series:" {} \;Repository: swallowedB/b-log Length of output: 76 시리즈 ID 대소문자 불일치로 인한 조회 실패 발생 현재 코드에서 발견된 문제들:
레지스트리의 모든 시리즈 ID를 🤖 Prompt for AI Agents |
||
|
|
||
| const recentCount = catPosts.filter((p) => | ||
| isWithinLastNDays(p.date, now, activityWindowDays) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
<Analytics />배치 위치 확인 필요.현재
<Analytics />가ThemeProvider바깥에 위치해 있습니다. 기능상 문제는 없지만, 일반적으로 컴포넌트 계층 구조의 일관성을 위해ThemeProvider내부에 배치하는 것이 더 자연스럽습니다.다만, Vercel Analytics는 테마 컨텍스트가 필요 없으므로 현재 위치도 정상 동작합니다.
♻️ (선택사항) ThemeProvider 내부로 이동
<ThemeProvider attribute="class" defaultTheme="system" enableSystem={true} storageKey="theme" > {children} + <Analytics /> </ThemeProvider> - <Analytics />📝 Committable suggestion
🤖 Prompt for AI Agents