refactor(config): basePath 정규화 로직을 단일 유틸리티로 통합 - #93
Merged
Conversation
- NEXT_PUBLIC_BASE_PATH 정규화 및 접두사 연결 로직을 src/lib/base-path.ts로 중앙화 - manifest.ts, markdown-content.tsx, pagefind.ts에서 중복 구현된 로직을 prefixBasePath로 교체 - basePath 유틸리티에 대한 엣지 케이스 단위 테스트(tests/base-path.test.ts) 추가
CoBool
force-pushed
the
refactor/base-path-utility
branch
from
August 16, 2026 12:15
826a10c to
e727902
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 내용
NEXT_PUBLIC_BASE_PATH환경변수의 슬래시 정규화 및 접두사 결합 로직을 담당하는src/lib/base-path.ts유틸리티 모듈 생성getBasePath(): 선행 슬래시 보장 및 후행 슬래시 제거, 미설정 시 빈 문자열 반환prefixBasePath(path): 정규화된 basePath를 대상 경로 앞에 안전하게 결합src/app/manifest.ts,src/components/markdown-content.tsx,src/features/search/pagefind.ts에서 각각 복제 구현되어 있던 로직을prefixBasePath로 통일undefined, 공백,/,/repo/,repo/, 중첩 경로 등)에 대한 단위 테스트(tests/base-path.test.ts) 추가변경 이유
/repo/) 배포 환경을 지원하기 위한basePath정규화 코드가 4곳 이상에 인라인으로 중복 구현되어 있었습니다.검증
pnpm lint: 통과pnpm typecheck: 통과pnpm test:tests/base-path.test.ts포함 33개 테스트 파일 / 234개 테스트 전체 통과pnpm build: SSG 정적 빌드 및 Pagefind 색인 생성 성공