feat(site): support PUBLIC_API_BASE_URL for Vercel develop previews - #196
Merged
Merged
Conversation
Lets a preview build serve develop's UI while reading main's live public dump instead of regenerating its own — no code needed beyond setting the env var on the preview deployment.
Member
TechEngine change review: PASS
Changed data
Changed record examples
Heuristic review
Changed site
Modified site files
|
Member
TechEngine validation stats: PASS
Data summary
Warning Tracked verified coverage is below 50% for watch 4.2% (18/433), tablet 6.3% (218/3455), soc 6.9% (146/2104), brand 11.6% (24/207), smartphone 18.6% (17384/93396), all 20.2% (21389/105758), gpu 39.9% (809/2030), pda 47.1% (66/140). Validation notes
Key output:
Homepage build: |
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.
Refs #1
develop을 Vercel에 연결해 프리뷰 배포를 할 때, develop 자체의 덤프를 새로 만들지 않고 main의 실제 운영 데이터를 그대로 읽어서 "코드는 develop, 데이터는 main"인 프리뷰를 띄울 수 있게 하는 최소 변경.
변경
site/astro.config.mjs: Vercel(process.env.VERCEL)에서는base: '/', 그 외(GitHub Pages)는 기존대로/TechAPI.site/src/scripts/techapi.js,site/src/pages/docs.astro,site/src/pages/index.astro: 데이터 fetch/링크 URL이PUBLIC_API_BASE_URL환경변수를 우선 사용(없으면 기존BASE_URL그대로) — 사이트 내비게이션/에셋 경로는 그대로base유지.검증
npm run build, 환경변수 없음): 기존과 동일하게/TechAPI/...경로 생성 확인.VERCEL=1 PUBLIC_API_BASE_URL=https://gettechapi.github.io/TechAPI/ npx astro build: nav/에셋은/(루트) 경로, 데이터 fetch·OpenAPI 문서 URL·엔드포인트 링크는 모두https://gettechapi.github.io/TechAPI/...로 정확히 렌더링됨을 빌드 산출물에서 직접 확인.남은 것 (계정 필요, 별도)
Vercel 프로젝트 생성·GitHub 연결·Root Directory를
site로 지정·Preview 환경변수에PUBLIC_API_BASE_URL=https://gettechapi.github.io/TechAPI/추가는 Vercel 계정 소유자가 직접 해야 함.Closes #19