|
1 | | -# React + TypeScript + Vite |
2 | | - |
3 | | -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
4 | | - |
5 | | -Currently, two official plugins are available: |
6 | | - |
7 | | -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
9 | | - |
10 | | -## Expanding the ESLint configuration |
11 | | - |
12 | | -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: |
13 | | - |
14 | | -```js |
15 | | -export default tseslint.config({ |
16 | | - extends: [ |
17 | | - // Remove ...tseslint.configs.recommended and replace with this |
18 | | - ...tseslint.configs.recommendedTypeChecked, |
19 | | - // Alternatively, use this for stricter rules |
20 | | - ...tseslint.configs.strictTypeChecked, |
21 | | - // Optionally, add this for stylistic rules |
22 | | - ...tseslint.configs.stylisticTypeChecked, |
23 | | - ], |
24 | | - languageOptions: { |
25 | | - // other options... |
26 | | - parserOptions: { |
27 | | - project: ['./tsconfig.node.json', './tsconfig.app.json'], |
28 | | - tsconfigRootDir: import.meta.dirname, |
29 | | - }, |
30 | | - }, |
31 | | -}) |
| 1 | +# PyCon Korea Frontend (2025 - ) |
| 2 | + |
| 3 | +2025년 이후부터 PyCon Korea 사이트들의 모노레포입니다. |
| 4 | + |
| 5 | +## 구성 |
| 6 | + |
| 7 | +- `apps/pyconkr-2025` — 2025 행사 사이트 |
| 8 | +- `apps/pyconkr-2026` — 2026 행사 사이트 |
| 9 | +- `apps/pyconkr-admin` — 관리자 페이지 |
| 10 | +- `apps/pyconkr-participant-portal` — 참가자 포털 |
| 11 | +- `packages/common`, `packages/shop` — 앱들이 공유하는 코드 |
| 12 | +- `dotenv/` — 모든 앱이 공유하는 환경변수 파일 |
| 13 | + |
| 14 | +## 요구 사항 |
| 15 | + |
| 16 | +- Node.js 22+ |
| 17 | +- pnpm (`package.json`의 `packageManager` 필드 버전. `corepack enable`로 자동 설치 가능) |
| 18 | +- 첫 실행 시 mkcert가 로컬 CA를 시스템 신뢰 저장소에 자동 설치합니다 (관리자 비밀번호 요구될 수 있음) |
| 19 | + |
| 20 | +## 설치 |
| 21 | + |
| 22 | +```bash |
| 23 | +pnpm install |
32 | 24 | ``` |
33 | 25 |
|
34 | | -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: |
35 | | - |
36 | | -```js |
37 | | -// eslint.config.js |
38 | | -import reactX from 'eslint-plugin-react-x' |
39 | | -import reactDom from 'eslint-plugin-react-dom' |
40 | | - |
41 | | -export default tseslint.config({ |
42 | | - plugins: { |
43 | | - // Add the react-x and react-dom plugins |
44 | | - 'react-x': reactX, |
45 | | - 'react-dom': reactDom, |
46 | | - }, |
47 | | - rules: { |
48 | | - // other rules... |
49 | | - // Enable its recommended typescript rules |
50 | | - ...reactX.configs['recommended-typescript'].rules, |
51 | | - ...reactDom.configs.recommended.rules, |
52 | | - }, |
53 | | -}) |
| 26 | +## 환경변수 |
| 27 | + |
| 28 | +기본값은 `dotenv/.env.development`(원격 dev 백엔드)와 `dotenv/.env.production`에 들어 있고, 그대로 둬도 dev는 동작합니다. |
| 29 | + |
| 30 | +| 키 | 설명 | |
| 31 | +|---|---| |
| 32 | +| `VITE_PYCONKR_BACKEND_API_DOMAIN` | 백엔드 API 도메인. dev 서버에서는 vite proxy(`/v1`, `/api`)의 target으로 쓰이고, prod 빌드에서는 브라우저가 직접 호출합니다. | |
| 33 | +| `VITE_PYCONKR_BACKEND_CSRF_COOKIE_NAME` | 백엔드 CSRF 토큰 쿠키 이름. 환경(prod / dev / local)별로 prefix가 달라서 분리되어 있습니다. | |
| 34 | +| `VITE_PYCONKR_FRONTEND_DOMAIN` | 프론트엔드의 외부 도메인. 관리자 페이지의 외부 링크 생성 등에 사용됩니다. | |
| 35 | +| `VITE_PYCONKR_SHOP_IMP_ACCOUNT_ID` | PortOne(아임포트) 가맹점 식별자. 결제 모듈 초기화에 사용됩니다. | |
| 36 | + |
| 37 | +로컬에서 값을 덮어쓰고 싶다면 **`dotenv/.env.development.local`**(gitignored)을 만들어 사용하세요. 예: 로컬에서 직접 띄운 백엔드를 쓰고 싶을 때 — |
| 38 | + |
| 39 | +```bash |
| 40 | +VITE_PYCONKR_BACKEND_API_DOMAIN=http://localhost:8000 |
| 41 | +VITE_PYCONKR_BACKEND_CSRF_COOKIE_NAME=LOCAL_PYCONKR_BACKEND_csrftoken |
54 | 42 | ``` |
| 43 | + |
| 44 | +## 개발 서버 실행 |
| 45 | + |
| 46 | +각 앱은 `https://localhost:<port>`로 뜹니다. 포트는 vite가 비어 있는 것을 자동 선택 (보통 5173부터). |
| 47 | + |
| 48 | +```bash |
| 49 | +pnpm dev:@apps/pyconkr-2025 |
| 50 | +pnpm dev:@apps/pyconkr-2026 |
| 51 | +pnpm dev:@apps/pyconkr-admin |
| 52 | +pnpm dev:@apps/pyconkr-participant-portal |
| 53 | +``` |
| 54 | + |
| 55 | +백엔드 호출은 vite proxy(`/v1`, `/api`)로 forward되므로 별도 `/etc/hosts` 설정은 필요 없습니다. CORS와 쿠키(`Secure`, `Domain` 속성)도 proxy 단에서 자동으로 처리합니다. |
| 56 | + |
| 57 | +## 빌드 / 프리뷰 |
| 58 | + |
| 59 | +```bash |
| 60 | +pnpm build:@apps/pyconkr-2025 |
| 61 | +pnpm preview:@apps/pyconkr-2025 |
| 62 | +``` |
| 63 | + |
| 64 | +다른 앱도 동일한 패턴 (`build:@apps/<app>`, `preview:@apps/<app>`). |
| 65 | + |
| 66 | +## 린트 / 포맷 |
| 67 | + |
| 68 | +```bash |
| 69 | +pnpm lint |
| 70 | +pnpm format # 자동 수정 |
| 71 | +pnpm format:check # 검사만 |
| 72 | +``` |
| 73 | + |
| 74 | +## 자주 마주치는 이슈 |
| 75 | + |
| 76 | +- **TS 에러가 IDE에 떠 있는데 빌드/dev는 잘 됨**: 패키지 버전 변경 후 `node_modules/.pnpm/`에 orphan이 남아 IDE TS 서비스가 헷갈리는 경우입니다. `rm -rf node_modules && pnpm install` 후 VS Code의 TypeScript 서버를 재시작하세요. |
| 77 | +- **mkcert 인증서 오류**: `mkcert -install`을 한 번 직접 실행해보세요. |
0 commit comments