react

package
v0.0.0-...-71b3825 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 18 Imported by: 0

README

pkg/generate/react

변경이력

  • 2026-04-28: 초기 작성

역할

React 19 + Vite + TanStack Query + shadcn-like 프론트엔드 스캐폴드를 emit 한다. OpenAPI → TypeScript 타입 (openapi-typescript) + operationId 기반 apiClient + manifest.theme 반영 Tailwind 설정 일체를 한 sequence 에 산출.

진입점

함수 시그니처 설명
Generate (fs *yongol.Fullstack, artifactsDir string) error React + Vite + TanStack Query + shadcn-like 스캐폴드 전체 방출

산출물

arts/frontend/
├── package.json / vite.config.ts / tsconfig.json
├── tailwind.config.js / postcss.config.js / src/index.css   ← manifest.theme 반영
├── index.html / src/main.tsx / src/App.tsx
├── src/api.ts                                                ← operationId apiClient
├── src/types/api.d.ts                                        ← openapi-typescript 출력 (or stub)
├── src/lib/utils.ts                                          ← cn() 헬퍼
└── src/components/ui/*.tsx                                   ← shadcn-like 프리미티브 10종

openapi-typescript 바이너리는 env → PATH → npx 순으로 해결, 부재 시 fallback stub api.d.ts 기록.

frontend tsc 게이트 (Phase041)

runFrontend 의 마지막 단계로 RunTscCheckarts/frontend/ 에서 tsc --noEmit 스모크를 돌린다 — backend 의 go build 에 대응하는 frontend 컴파일 게이트. 타입 에러가 있으면 그 출력과 함께 generate 가 실패한다("generate 성공 = 빌드 가능" 불변식). tsc 해석은 프로젝트 node_modules/.binresolveTscArgv(env → npx -p typescript tsc) 순이며, 해석 불가(node_modules/tsc/npx 부재) 시 경고 후 skip(generate 실패 아님) — 강제하려면 frontend deps 를 설치한다(CI/dev). run_tsc_check.go / resolve_tsc_argv.go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(fs *yongol.Fullstack, artifactsDir string) error

Generate materializes the full React scaffold under <artifactsDir>/frontend/. Emitted artifacts:

index.html, package.json, tsconfig.json, vite.config.ts
tailwind.config.js, postcss.config.js
src/main.tsx, src/App.tsx, src/index.css
src/lib/api.ts — operationId-keyed api (openapi-fetch + typed paths)
src/types/api.d.ts — openapi-typescript output (spawn)
src/lib/utils.ts — shadcn cn() helper
src/components/ui/*.tsx — 10 shadcn-like primitives
src/lib/breadcrumbs.ts + src/components/ui/Breadcrumb.tsx — static
breadcrumb trails from frontend/sitemap.html (sitemap present only)

Page files (src/pages/*.tsx) are **not** emitted — TSX is the SSOT, so yongol reads them, not writes them.

func RunTscCheck

func RunTscCheck(artifactsDir string) error

RunTscCheck spawns `tsc --noEmit` over the generated frontend tree (<artifactsDir>/frontend) so the "generate success = buildable" invariant is enforced for the frontend, symmetric to the backend `go build` step. A compile error fails generate (the gate); exit 0 passes.

Graceful skip (warn, not fail) when the toolchain is unresolved: no project node_modules (imported packages like react/@tanstack would not resolve — a false gate) or no tsc/npx. Auto `npm install` is out of scope.

Types

This section is empty.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL