@uiwwsw/next-test-mode 0.7.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.1 — 2026-10-19
4
+
5
+ - Focus the homepage on changing data in the console and checking the page. Remove rendering-mode navigation and technical cache controls from the demo UI.
6
+ - Keep rendering support and the session-scoped preview mechanism in the English and Korean READMEs. Existing rendering routes and APIs remain compatible.
7
+
8
+ ## 1.0.0 — 2026-10-19
9
+
10
+ - First stable release of the console-first Next.js development and QA workflow.
11
+ - Reframe the README and demo around testing fetch data and page states from the console, with server and static rendering examples demonstrating the same workflow.
12
+ - Add English and Korean landing pages and READMEs, localized search/social metadata, canonical and language alternate links, robots.txt and sitemap.xml.
13
+ - Upgrade the demo, fixture and minimum Next peer to 16.4.2, including upstream Draft Mode cache isolation fixes.
14
+ - Explain session-scoped Draft Mode previews and supported data boundaries. Existing 0.7 APIs remain compatible.
15
+
3
16
  ## 0.7.0 — Separate tests, inspect the server preview
4
17
 
5
18
  - Generate an app-owned test folder with one shared catalog, browser/server adapters and thin environment-gated hooks; migrate unchanged 0.5/0.6 setup without overwriting custom code.
package/README.ko.md ADDED
@@ -0,0 +1,209 @@
1
+ [English](./README.md) · **한국어**
2
+
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/uiwwsw/next-test-mode/v1.0.1/docs/assets/hero.png" width="100%" alt="Next Test Mode — 콘솔 한 줄로 서버 데이터까지 테스트." />
5
+ </p>
6
+ <p align="center">
7
+ <strong>콘솔 한 줄로. 서버 데이터까지 테스트.</strong><br />
8
+ One console command. Test server data, too.
9
+ </p>
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/@uiwwsw/next-test-mode"><img src="https://img.shields.io/npm/v/@uiwwsw/next-test-mode?style=flat-square&amp;color=173c36" alt="npm version" /></a>
12
+ <a href="https://github.com/uiwwsw/next-test-mode/actions/workflows/ci.yml"><img src="https://github.com/uiwwsw/next-test-mode/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
13
+ <img src="https://img.shields.io/badge/Next.js-App_Router-173c36?style=flat-square" alt="Next.js App Router" />
14
+ <a href="https://github.com/uiwwsw/next-test-mode/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-62796f?style=flat-square" alt="MIT license" /></a>
15
+ </p>
16
+ <p align="center">
17
+ <a href="https://test-mode-tau.vercel.app/">Live demo ↗</a> ·
18
+ <a href="#quick-start">Quick start</a> ·
19
+ <a href="#rendering-support">지원 범위</a> ·
20
+ <a href="https://github.com/uiwwsw/next-test-mode/blob/main/docs/guide.md">API 가이드</a> ·
21
+ <a href="https://github.com/uiwwsw/next-test-mode/blob/main/docs/migration.md">기존 패키지에서 이전</a>
22
+ </p>
23
+
24
+ **개발 중 필요한 데이터와 화면 상태를 콘솔 한 줄로 테스트하세요.** Next Test Mode는 Next.js 앱의 fetch 응답을 바꿔 빈 목록, 다른 가격, 서버 오류까지 실제 화면에서 재현하는 개발·QA 도구입니다. 기존 API 호출 코드는 그대로 사용합니다.
25
+
26
+ 브라우저 콘솔만으로는 서버가 이미 만든 HTML이나 빌드 시점에 고정된 데이터를 바꾸기 어렵습니다. **이 도구는 콘솔의 테스트 값을 서버까지 전달하고, 개발·QA 세션의 렌더 경로를 열어 같은 데이터로 화면을 다시 그립니다.** 평소 데브 모드에서 여러 화면 상태를 흉내 내며 개발하듯, 렌더 방식에 관계없이 같은 명령으로 확인하는 것이 핵심입니다.
27
+
28
+ CSR·SSR·ISR·SSG 예제는 이 범위를 직접 확인하기 위한 것입니다. 원래 렌더 방식을 서로 변환하거나 production의 정적 파일을 다시 만드는 기능은 아닙니다. 지원하는 fetch 기반 데이터는 콘솔에서 mock·patch할 수 있으며, DB 직접 조회 등은 별도 연결이 필요합니다.
29
+
30
+ > `@uiwwsw/test-mode`의 새 이름은 **`@uiwwsw/next-test-mode`**입니다. [이전 가이드](https://github.com/uiwwsw/next-test-mode/blob/main/docs/migration.md).
31
+
32
+ ## Why Next Test Mode
33
+
34
+ | 호출 코드는 그대로 | 테스트 데이터는 따로 | 확인은 콘솔에서 |
35
+ | :--- | :--- | :--- |
36
+ | 최초 설정 후 기존 `fetch()`를 계속 사용합니다. 각 API 호출부에 테스트 함수나 조건 분기를 추가할 필요가 없습니다. | 한 번 확인할 값은 콘솔에서 끝내고, 반복할 시나리오는 `src/test-mode/` 같은 전용 폴더에서 수정하고 공유합니다. | `test.patch()` 한 줄로 가격을 바꾸고 `test.mock()`으로 빈 목록·오류를 넣습니다. `test.clear()`로 원래 응답에 돌아갑니다. |
37
+
38
+ ```ts
39
+ // 앱의 API 호출: 테스트를 켜도 이 코드는 그대로입니다.
40
+ const response = await fetch('https://api.example.com/api/cart');
41
+ const cart = await response.json();
42
+ ```
43
+
44
+ ```js
45
+ // DevTools → Console: 자신의 API pathname을 사용하세요.
46
+ test.patch('/api/cart', { total: 9.99 });
47
+ // Draft Mode 연결 → 자동 새로고침 → 바뀐 데이터로 화면 확인
48
+ test.clear();
49
+ ```
50
+
51
+ ## Quick start
52
+
53
+ Next.js **16 App Router / Node.js 20.9+** 프로젝트 루트에서:
54
+
55
+ ```bash
56
+ npm install @uiwwsw/next-test-mode
57
+ npx @uiwwsw/next-test-mode init
58
+ npm run dev
59
+ ```
60
+
61
+ 설치 명령이 `app/` 또는 `src/app/`, JavaScript/TypeScript를 감지해 **얇은 연결 파일 세 개와 테스트 전용 폴더**를 생성합니다.
62
+
63
+ | 파일 | 하는 일 |
64
+ | :--- | :--- |
65
+ | `instrumentation.ts` 또는 `.js` | 서버의 기존 fetch에 요청별 테스트 데이터 연결 |
66
+ | `instrumentation-client.ts` 또는 `.js` | Console·브라우저 fetch·Draft Mode·자동 새로고침 연결 |
67
+ | `app/api/next-test-mode/route.ts` 또는 `.js` | Next.js의 Draft Mode 쿠키를 켜고 끄는 POST 경로 |
68
+
69
+ ```text
70
+ src/ # src 없는 앱은 프로젝트 루트
71
+ app/ # 실제 페이지와 API: 테스트 폴더를 import하지 않음
72
+ test-mode/
73
+ catalog.ts # mock · patch · story: 이곳만 편집
74
+ client.ts # Console와 브라우저 연결
75
+ server.ts # 서버 fetch와 Draft 연결
76
+ ```
77
+
78
+ 테스트 정의는 `catalog.ts` 한 곳에 두고 브라우저와 서버가 함께 사용합니다. 일반 production 빌드에서는 조건부 연결이 제거됩니다. CI는 **테스트 카탈로그가 브라우저·서버 번들에서 빠지는지** 실제 빌드 산출물로 확인합니다. QA 빌드에는 의도적으로 포함됩니다.
79
+
80
+ 페이지, API 함수, Next 설정 파일은 수정하지 않습니다. 기존 사용자 파일이 있으면 변경 없이 합칠 코드를 출력합니다. 워커나 별도 서버는 필요하지 않습니다.
81
+
82
+ 기본 설정은 개발 환경에서만 켜집니다. **QA 배포에서도 사용하려면 `NEXT_PUBLIC_NEXT_TEST_MODE=1`을 빌드와 실행 환경에 설정**하세요. [생성 코드와 접근 제어](https://github.com/uiwwsw/next-test-mode/blob/main/docs/server-rendering.md).
83
+
84
+ ## See it in action
85
+
86
+ **[콘솔 데모 열기](https://test-mode-tau.vercel.app/)** — 값을 바꾸고 화면을 확인한 뒤 `test.clear()`로 돌아오세요.
87
+
88
+ <p align="center">
89
+ <img src="https://raw.githubusercontent.com/uiwwsw/next-test-mode/v1.0.1/docs/assets/scenarios.gif" width="960" alt="실제 Next.js 데모: SSG 원래 가격, 콘솔 patch, SSR에서도 같은 값, HTTP 503, 원래 캐시 응답 복귀." />
90
+ </p>
91
+
92
+ 데모의 DevTools Console에 입력하거나, 화면의 JSON 편집기에서 원하는 값을 적용하세요.
93
+
94
+ ```js
95
+ test.patch('/api/cart.json', { total: 9.99 });
96
+ test.mock('/api/cart.json', { items: [], total: 0 });
97
+ test.mock('/api/cart.json', { message: 'Try again' }, { status: 503 });
98
+ test.overrides(); // 직접 입력한 값 확인
99
+ test.reset('/api/cart.json'); // 이 경로의 직접 입력만 제거
100
+ test.clear(); // 모든 입력과 시나리오 해제
101
+ ```
102
+
103
+ 서버 렌더 미리보기에서는 **서버가 보낸 HTML 자체에 변경된 값이 들어갑니다.** 다른 브라우저 세션의 원래 응답은 유지됩니다. JSON 상태는 같은 브라우저의 탭이 공유하며 새로고침 후에도 유지됩니다. 테스트가 끝나면 `test.clear()`를 사용하세요.
104
+
105
+ ## Rendering support
106
+
107
+ 브라우저 콘솔만으로는 이미 만들어진 서버 HTML이나 SSG 산출물을 직접 바꿀 수 없습니다. Next Test Mode는 테스트 값을 서버에 전달하고 Draft Mode로 해당 세션의 캐시를 우회해 새 HTML을 렌더합니다. 덕분에 개발자는 렌더 방식을 골라 테스트하지 않고 같은 콘솔 명령으로 지원하는 fetch 데이터와 화면 상태를 재현합니다. CSR은 브라우저 fetch를 가로채고, 서버 페이지는 테스트 쿠키로 값을 전달받습니다. 렌더별 동작과 제한은 아래 표에서 확인하세요.
108
+
109
+ | 렌더 방식 | Console 변경 후 동작 |
110
+ | :--- | :--- |
111
+ | **CSR** | 브라우저 fetch 응답 교체 또는 patch, 페이지 자동 새로고침 |
112
+ | **SSR / Server Components** | 해당 요청의 서버 fetch에 값 적용 → 새 HTML |
113
+ | **SSG / `force-static`** | Draft Mode에서 정적 결과를 우회해 세션별 동적 미리보기 |
114
+ | **ISR** | Draft Mode에서 기존 페이지·데이터 캐시를 우회해 미리보기. 공용 ISR 결과는 변경하지 않음 |
115
+ | **`unstable_cache` / `use cache`** | Draft Mode의 캐시 우회 경로에서 실행되는 fetch에 적용 |
116
+ | **`generateStaticParams`** | 빌드에서 생성한 경로의 페이지 미리보기 지원. 콘솔로 빌드 시 경로 목록을 다시 만들지는 않음 |
117
+
118
+ `test.clear()`는 이 도구가 연 Draft Mode를 해제해 원래 캐시 경로로 복귀합니다. **SSG 파일을 다시 쓰거나 모든 방문자의 ISR 캐시를 갱신하는 기능은 아닙니다.** 이미 켜진 CMS Draft 세션은 해제하지 않습니다.
119
+
120
+ 실제 production 빌드로 검증한 기준은 **Next.js 16.4.2 / App Router / Node 런타임**입니다. Pages Router, Edge, `output: 'export'`는 자동 연결 대상이 아닙니다. 직접 DB 조회, XHR·WebSocket, fetch를 거치지 않는 외부 캐시에도 별도 어댑터가 필요합니다. 캐시 내부의 요청 쿠키를 읽는 작은 Next 내부 브리지가 있어, Next 버전 업그레이드 시 production 회귀 테스트가 필요합니다. [동작 원리와 호환성](https://github.com/uiwwsw/next-test-mode/blob/main/docs/server-rendering.md).
121
+
122
+ ## Console controls the server preview
123
+
124
+ 콘솔에서 바꾼 값이 서버에서 렌더한 HTML까지 바뀌는 것이 핵심입니다. **데이터를 조작하지 않고 캐시만 우회해서 실제 응답을 다시 확인할 수도 있습니다.**
125
+
126
+ ```js
127
+ test.cache.bypass(); // 내 Next Draft 세션에서 새 서버 렌더. mock 없어도 사용 가능
128
+ test.cache.status(); // 연결 상태, Draft 활성 여부, 미반영 변경, 오류 확인
129
+ test.cache.refresh(); // 같은 값으로 다시 렌더
130
+ test.cache.restore(); // 테스트 입력·시나리오·수동 우회 해제, 기본 캐시 경로 복귀
131
+ ```
132
+
133
+ `bypass()`는 기존 mock/patch를 유지합니다. `refresh()`는 Draft가 켜져 있을 때 새 서버 렌더를 요청하며, 꺼져 있으면 기존 캐시 정책을 따릅니다.
134
+
135
+ 일반 mock/patch는 캐시 우회를 자동으로 연결하므로 이 명령들을 따로 호출할 필요가 없습니다. `test.clear()`도 전체 테스트를 해제합니다. 초기화 시 기존 CMS Draft 세션은 유지합니다.
136
+
137
+ **제어 범위는 내 브라우저 세션의 Next 렌더링·데이터 캐시 경로입니다.** 공용 캐시를 삭제하지 않으며, 브라우저 HTTP 캐시·SWR/React Query·Redis·외부 CDN을 일괄 무효화하지 않습니다. [캐시별 동작과 설계](https://github.com/uiwwsw/next-test-mode/blob/main/docs/concept.md).
138
+
139
+ ## Try once, or keep it in a folder
140
+
141
+ **잠깐 확인할 테스트는 콘솔에서 끝내세요.** `test.mock()` / `test.patch()` → 화면 확인 → `test.clear()`. 임시 실험 때문에 파일이나 API 호출 코드를 고칠 필요가 없습니다.
142
+
143
+ **반복할 테스트는 `init`이 생성한 `test-mode/catalog.ts`에서 관리하세요.**
144
+
145
+ ```text
146
+ src/
147
+ api/cart.ts # 기존 API 호출
148
+ test-mode/
149
+ catalog.ts # 브라우저·서버에서 공유할 등록 목록
150
+ features/cart.ts # API별 mock / patch와 데이터
151
+ stories/cart.stories.ts # 여러 API를 묶은 화면 시나리오
152
+ ```
153
+
154
+ ```ts
155
+ // src/test-mode/catalog.ts
156
+ import { defineMock } from '@uiwwsw/next-test-mode/core';
157
+
158
+ export const catalog = {
159
+ cookieKey: 'test-mode.entries',
160
+ definitions: [
161
+ defineMock('/api/cart', () => ({ items: [], total: 0 }), {
162
+ caseKey: 'empty',
163
+ pages: ['/cart'],
164
+ }),
165
+ ],
166
+ };
167
+ ```
168
+
169
+ 생성된 두 설치 파일이 같은 catalog를 자동으로 읽습니다. Console에서 `test.feat.add('/api/cart:empty')`로 선택하세요. 여러 API를 묶은 story도 `test.story('cart.empty')`로 활성화합니다. 서버에서도 쓸 정의에는 브라우저 전용 코드를 넣지 마세요.
170
+
171
+ `init`을 다시 실행해도 편집한 테스트 폴더를 덮어쓰지 않습니다. 0.5/0.6의 변경하지 않은 자동 생성 설정은 `init --migrate`로 옮길 수 있습니다. 사용자 코드가 섞인 연결 파일은 변경 없이 합칠 내용을 안내합니다.
172
+
173
+ ## Details that matter
174
+
175
+ - 직접 입력은 **GET + 정확한 pathname**에 매칭합니다. 다른 메서드는 `{ method: 'POST' }` 옵션으로 지정합니다. 여러 호스트의 같은 pathname은 함께 매칭됩니다.
176
+ - `patch`는 실제 응답의 최상위 필드를 덮어씁니다. 중첩 객체와 배열은 통째로 교체되며, 실제 네트워크 요청은 실행됩니다. `mock`은 매칭된 요청의 응답을 직접 만듭니다.
177
+ - 쿠키로 전달하는 전체 선택·JSON 상태는 URL 인코딩 후 **3,500바이트**까지입니다. 큰 응답은 작은 patch 또는 파일에 정의한 시나리오로 관리하세요. 브라우저 세션 복원 설정에 따라 쿠키도 복원될 수 있습니다.
178
+ - Draft 연결 실패는 Console 오류와 `next-test-mode:error` 이벤트로 알리며 자동 새로고침하지 않습니다. `ready` / `sync()`로 성공 여부를 기다릴 수 있습니다. [클라이언트 API](https://github.com/uiwwsw/next-test-mode/blob/main/docs/server-rendering.md#클라이언트-연결-상태).
179
+ - 테스트 쿠키는 로그인 자격이 아닙니다. QA 환경의 접근 권한은 앱이 관리합니다. 들어온 인증 쿠키를 외부 API에 자동 전달하지 않습니다.
180
+ - 이 패키지는 **화면 상태를 재현하는 도구**입니다. 자동 assertion·합격 판정은 Playwright나 Vitest가 담당합니다.
181
+
182
+ ## Framework-independent APIs
183
+
184
+ 기존 범용 core·browser·Node API도 새 이름 아래 유지합니다. Next.js는 선택적 peer이며, 범용 API는 Next 없이 설치할 수 있습니다. 외부 런타임 의존성은 없습니다.
185
+
186
+ ```ts
187
+ import { setupTestMode } from '@uiwwsw/next-test-mode';
188
+ import { createTestMode, defineMock } from '@uiwwsw/next-test-mode/core';
189
+ import { createMockFetch } from '@uiwwsw/next-test-mode/fetch';
190
+ import { withTestMode } from '@uiwwsw/next-test-mode/node';
191
+ import { createServerTestMode } from '@uiwwsw/next-test-mode/server';
192
+ ```
193
+
194
+ 일반 브라우저 앱은 `setupTestMode({ enabled: true, refresh: () => refetch() })`를 시작 시 한 번 연결합니다. 이 범용 설정의 직접 JSON은 기본적으로 메모리에만 남습니다. Next에서는 Draft Mode를 연결하는 `init` 설정을 사용하세요. [전체 API 가이드](https://github.com/uiwwsw/next-test-mode/blob/main/docs/guide.md).
195
+
196
+ ## Develop & release
197
+
198
+ ```bash
199
+ npm ci
200
+ npx playwright install chromium
201
+ npm run ci # 타입, 런타임, tarball 설치와 소비자 타입 검사
202
+ npm run test:browser # 브라우저 Console·fetch·Draft 연결
203
+ npm run test:next # 실제 Next dev/production/Cache Components/비활성 배포
204
+ npm run test:demo # 네 렌더 모드와 모바일 JSON 편집기
205
+ npm run dev:demo # 실제 Next.js 데모
206
+ npm run build:demo # Vercel 배포용 Next 빌드
207
+ ```
208
+
209
+ 검증된 main의 릴리스 태그를 GitHub Release로 발행하면, CI를 다시 통과한 패키지가 `NPM_TOKEN`을 사용하는 Actions에서 npm provenance와 함께 배포됩니다. [배포 절차](https://github.com/uiwwsw/next-test-mode/blob/main/docs/releasing.md) · [설계](https://github.com/uiwwsw/next-test-mode/blob/main/docs/architecture.md) · [Changelog](https://github.com/uiwwsw/next-test-mode/blob/main/CHANGELOG.md).
package/README.md CHANGED
@@ -1,50 +1,47 @@
1
+ **English** · [한국어](./README.ko.md)
2
+
1
3
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/uiwwsw/next-test-mode/v0.7.0/docs/assets/hero.png" width="100%" alt="Next Test Mode — Same API calls. Your test data. CSR, SSR, ISR and SSG from one Console." />
3
- </p>
4
- <p align="center">
5
- <strong>호출 코드는 그대로. 테스트 데이터는 따로. 확인은 콘솔에서.</strong><br />
6
- Keep your fetch calls. Keep scenarios separate. Preview from DevTools.
4
+ <img src="https://raw.githubusercontent.com/uiwwsw/next-test-mode/v1.0.1/docs/assets/hero.png" width="100%" alt="Next Test Mode — One console. Server data, too." />
7
5
  </p>
6
+ <p align="center"><strong>Test Next.js API data and page states from the console.</strong><br />Keep your fetch calls. Try the data you need. Check the real page.</p>
8
7
  <p align="center">
9
8
  <a href="https://www.npmjs.com/package/@uiwwsw/next-test-mode"><img src="https://img.shields.io/npm/v/@uiwwsw/next-test-mode?style=flat-square&amp;color=173c36" alt="npm version" /></a>
10
9
  <a href="https://github.com/uiwwsw/next-test-mode/actions/workflows/ci.yml"><img src="https://github.com/uiwwsw/next-test-mode/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
11
10
  <img src="https://img.shields.io/badge/Next.js-App_Router-173c36?style=flat-square" alt="Next.js App Router" />
12
- <a href="https://github.com/uiwwsw/next-test-mode/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-62796f?style=flat-square" alt="MIT license" /></a>
13
- </p>
14
- <p align="center">
15
- <a href="https://test-mode-tau.vercel.app/">Live demo ↗</a> ·
16
- <a href="#quick-start">Quick start</a> ·
17
- <a href="#rendering-support">지원 범위</a> ·
18
- <a href="https://github.com/uiwwsw/next-test-mode/blob/main/docs/guide.md">API 가이드</a> ·
19
- <a href="https://github.com/uiwwsw/next-test-mode/blob/main/docs/migration.md">기존 패키지에서 이전</a>
11
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-62796f?style=flat-square" alt="MIT license" /></a>
20
12
  </p>
13
+ <p align="center"><a href="https://test-mode-tau.vercel.app/en">Live demo ↗</a> · <a href="#quick-start">Quick start</a> · <a href="#rendering-support">Compatibility</a> · <a href="./docs/guide.md">API guide</a></p>
14
+
15
+ **Reproduce the data and page states you need during development with one console command.** Next Test Mode is a development and QA tool for mocking and patching Next.js fetch responses: empty lists, different prices, server errors, and reusable scenarios, without editing individual API calls.
21
16
 
22
- **Next Test Mode는 Next.js 앱의 API 응답을 콘솔에서 바꿔 화면 상태를 재현하는 개발·QA 도구입니다.** 빈 목록, 다른 가격, 서버 오류를 실제 화면에서 확인하세요. CSR은 브라우저 응답을 바꾸고, SSR·ISR·SSG는 **Next Draft Mode를 자동으로 연결해 해당 브라우저 세션에서 새로 렌더**합니다.
17
+ The browser console alone cannot easily change HTML already rendered on the server or data fixed at build time. **Next Test Mode carries your console values to the server and opens a session-scoped preview path.** Just as you reproduce different page states in dev mode, you can use the same commands across browser, server, and static page examples.
23
18
 
24
- > `@uiwwsw/test-mode`의 새 이름은 **`@uiwwsw/next-test-mode`**입니다. [이전 가이드](https://github.com/uiwwsw/next-test-mode/blob/main/docs/migration.md).
19
+ CSR, SSR, ISR and SSG demonstrate the reach of this workflow. Server previews use Next Draft Mode to bypass static and revalidation caches for your test session. They do not regenerate public static files or change other visitors' pages. Supported fetch-based data can be mocked or patched; direct database calls and other transports need separate integration.
20
+
21
+ > `@uiwwsw/test-mode` is now **`@uiwwsw/next-test-mode`**. See the [migration guide](./docs/migration.md).
25
22
 
26
23
  ## Why Next Test Mode
27
24
 
28
- | 호출 코드는 그대로 | 테스트 데이터는 따로 | 확인은 콘솔에서 |
25
+ | Keep your calls | Test from the console | Save reusable scenarios |
29
26
  | :--- | :--- | :--- |
30
- | 최초 설정 후 기존 `fetch()`를 계속 사용합니다. 각 API 호출부에 테스트 함수나 조건 분기를 추가할 필요가 없습니다. | 한 번 확인할 값은 콘솔에서 끝내고, 반복할 시나리오는 `src/test-mode/` 같은 전용 폴더에서 수정하고 공유합니다. | `test.patch()` 한 줄로 가격을 바꾸고 `test.mock()`으로 빈 목록·오류를 넣습니다. `test.clear()`로 원래 응답에 돌아갑니다. |
27
+ | Connect once and keep existing `fetch()` calls. No per-call test branches. | Change values, reload automatically, and check the actual page, including server HTML. | Keep repeated tests in a dedicated folder shared by the browser and server. |
31
28
 
32
29
  ```ts
33
- // 앱의 API 호출: 테스트를 켜도 이 코드는 그대로입니다.
30
+ // Your application code stays the same.
34
31
  const response = await fetch('https://api.example.com/api/cart');
35
32
  const cart = await response.json();
36
33
  ```
37
34
 
38
35
  ```js
39
- // DevTools → Console: 자신의 API pathname을 사용하세요.
36
+ // DevTools → Console: use your own API pathname.
40
37
  test.patch('/api/cart', { total: 9.99 });
41
- // Draft Mode 연결 → 자동 새로고침 → 바뀐 데이터로 화면 확인
38
+ // Draft Mode connects automatically and the page refreshes.
42
39
  test.clear();
43
40
  ```
44
41
 
45
42
  ## Quick start
46
43
 
47
- Next.js **16 App Router / Node.js 20.9+** 프로젝트 루트에서:
44
+ From a **Next.js 16 App Router / Node.js 20.9+** project:
48
45
 
49
46
  ```bash
50
47
  npm install @uiwwsw/next-test-mode
@@ -52,99 +49,85 @@ npx @uiwwsw/next-test-mode init
52
49
  npm run dev
53
50
  ```
54
51
 
55
- 설치 명령이 `app/` 또는 `src/app/`, JavaScript/TypeScript를 감지해 **얇은 연결 파일 세 개와 테스트 전용 폴더**를 생성합니다.
52
+ The installer detects `app/` or `src/app/` and JavaScript or TypeScript. It generates three thin integration files and a dedicated test folder:
56
53
 
57
- | 파일 | 하는 일 |
54
+ | File | Purpose |
58
55
  | :--- | :--- |
59
- | `instrumentation.ts` 또는 `.js` | 서버의 기존 fetch에 요청별 테스트 데이터 연결 |
60
- | `instrumentation-client.ts` 또는 `.js` | Console·브라우저 fetch·Draft Mode·자동 새로고침 연결 |
61
- | `app/api/next-test-mode/route.ts` 또는 `.js` | Next.js의 Draft Mode 쿠키를 켜고 끄는 POST 경로 |
56
+ | `instrumentation.ts` or `.js` | Connect request-scoped test data to existing server fetch calls |
57
+ | `instrumentation-client.ts` or `.js` | Connect the console, browser fetch, Draft Mode and automatic refresh |
58
+ | `app/api/next-test-mode/route.ts` or `.js` | POST route to enable or disable the Next.js Draft Mode cookie |
62
59
 
63
60
  ```text
64
- src/ # src 없는 앱은 프로젝트 루트
65
- app/ # 실제 페이지와 API: 테스트 폴더를 import하지 않음
61
+ src/ # Project root when there is no src/
62
+ app/ # Real pages and APIs do not import the test folder
66
63
  test-mode/
67
- catalog.ts # mock · patch · story: 이곳만 편집
68
- client.ts # Console와 브라우저 연결
69
- server.ts # 서버 fetch와 Draft 연결
64
+ catalog.ts # Edit mock, patch and story definitions here
65
+ client.ts # Console and browser integration
66
+ server.ts # Server fetch and Draft integration
70
67
  ```
71
68
 
72
- 테스트 정의는 `catalog.ts` 한 곳에 두고 브라우저와 서버가 함께 사용합니다. 일반 production 빌드에서는 조건부 연결이 제거됩니다. CI는 **테스트 카탈로그가 브라우저·서버 번들에서 빠지는지** 실제 빌드 산출물로 확인합니다. QA 빌드에는 의도적으로 포함됩니다.
69
+ Browser and server share one catalog. The generated conditional integration excludes the test catalog from ordinary production builds; CI checks the actual client and server bundles. QA builds intentionally include it.
73
70
 
74
- 페이지, API 함수, Next 설정 파일은 수정하지 않습니다. 기존 사용자 파일이 있으면 변경 없이 합칠 코드를 출력합니다. 워커나 별도 서버는 필요하지 않습니다.
71
+ The installer leaves pages, API functions and Next configuration untouched. If an integration file already exists, it prints the code to merge without overwriting the file. No worker or separate server is required.
75
72
 
76
- 기본 설정은 개발 환경에서만 켜집니다. **QA 배포에서도 사용하려면 `NEXT_PUBLIC_NEXT_TEST_MODE=1`을 빌드와 실행 환경에 설정**하세요. [생성 코드와 접근 제어](https://github.com/uiwwsw/next-test-mode/blob/main/docs/server-rendering.md).
73
+ Development is enabled by default. To use an intentional QA deployment, set **`NEXT_PUBLIC_NEXT_TEST_MODE=1` at build time and runtime**. Your application owns access control. See [generated setup and authorization](./docs/server-rendering.md).
77
74
 
78
75
  ## See it in action
79
76
 
80
- **[CSR](https://test-mode-tau.vercel.app/csr) · [SSR](https://test-mode-tau.vercel.app/ssr) · [ISR](https://test-mode-tau.vercel.app/isr) · [SSG](https://test-mode-tau.vercel.app/ssg)** — 같은 장바구니를 네 가지 렌더 방식으로 직접 비교하세요.
77
+ Open the [English demo](https://test-mode-tau.vercel.app/en) or [한국어 데모](https://test-mode-tau.vercel.app/). Change a cart value in the console, check the updated page, then clear the test.
81
78
 
82
- <p align="center">
83
- <img src="https://raw.githubusercontent.com/uiwwsw/next-test-mode/v0.7.0/docs/assets/scenarios.gif" width="960" alt="실제 Next.js 데모: SSG 원래 가격, 콘솔 patch, SSR에서도 같은 값, HTTP 503, 원래 캐시 응답 복귀." />
84
- </p>
79
+ <p align="center"><img src="https://raw.githubusercontent.com/uiwwsw/next-test-mode/v1.0.1/docs/assets/scenarios.gif" width="960" alt="Console patch changes a static cart preview and server HTML; mock an HTTP error, then restore the original response." /></p>
85
80
 
86
- 데모의 DevTools Console에 입력하거나, 화면의 JSON 편집기에서 원하는 값을 적용하세요.
81
+ Use DevTools Console or the demo's JSON editor:
87
82
 
88
83
  ```js
89
84
  test.patch('/api/cart.json', { total: 9.99 });
90
85
  test.mock('/api/cart.json', { items: [], total: 0 });
91
86
  test.mock('/api/cart.json', { message: 'Try again' }, { status: 503 });
92
- test.overrides(); // 직접 입력한 값 확인
93
- test.reset('/api/cart.json'); // 이 경로의 직접 입력만 제거
94
- test.clear(); // 모든 입력과 시나리오 해제
87
+ test.overrides(); // Inspect console overrides
88
+ test.reset('/api/cart.json'); // Remove direct overrides for this path
89
+ test.clear(); // Clear all overrides and scenarios
95
90
  ```
96
91
 
97
- SSR·ISR·SSG 탭에서는 **서버가 보낸 HTML 자체에 변경된 값이 들어갑니다.** 다른 브라우저 세션의 원래 응답은 유지됩니다. JSON 상태는 같은 브라우저의 탭이 공유하며 새로고침 후에도 유지됩니다. 테스트가 끝나면 `test.clear()`를 사용하세요.
92
+ Server previews put the changed data in the **HTML returned by the server**. Other browser sessions keep their original responses. Values survive reloads and are shared by tabs in the same browser. Finish with `test.clear()`.
98
93
 
99
94
  ## Rendering support
100
95
 
101
- | 렌더 방식 | Console 변경 후 동작 |
96
+ In development and QA, browser fetch interception handles CSR. Server requests read test values from cookies. Next Draft Mode bypasses static and revalidation caches for that session, allowing a fresh HTML preview even for an SSG or ISR page.
97
+
98
+ | Rendering path | After a console change |
102
99
  | :--- | :--- |
103
- | **CSR** | 브라우저 fetch 응답 교체 또는 patch, 페이지 자동 새로고침 |
104
- | **SSR / Server Components** | 해당 요청의 서버 fetch에 값 적용 → 새 HTML |
105
- | **SSG / `force-static`** | Draft Mode에서 정적 결과를 우회해 세션별 동적 미리보기 |
106
- | **ISR** | Draft Mode에서 기존 페이지·데이터 캐시를 우회해 미리보기. 공용 ISR 결과는 변경하지 않음 |
107
- | **`unstable_cache` / `use cache`** | Draft Mode의 캐시 우회 경로에서 실행되는 fetch에 적용 |
108
- | **`generateStaticParams`** | 빌드에서 생성한 경로의 페이지 미리보기 지원. 콘솔로 빌드 시 경로 목록을 다시 만들지는 않음 |
100
+ | **CSR** | Intercept or patch browser fetch responses, then refresh |
101
+ | **SSR / Server Components** | Apply values to request-scoped server fetch calls and render new HTML |
102
+ | **SSG / `force-static`** | Bypass the static result through a session-scoped Draft Mode preview |
103
+ | **ISR** | Bypass the page and data cache for the preview; retain the shared ISR result |
104
+ | **`unstable_cache` / `use cache`** | Apply to fetch calls executed through the Draft Mode cache-bypass path |
105
+ | **`generateStaticParams`** | Preview existing generated routes; console commands do not regenerate the build-time route list |
109
106
 
110
- `test.clear()`는 이 도구가 연 Draft Mode를 해제해 원래 캐시 경로로 복귀합니다. **SSG 파일을 다시 쓰거나 모든 방문자의 ISR 캐시를 갱신하는 기능은 아닙니다.** 이미 켜진 CMS Draft 세션은 해제하지 않습니다.
107
+ `test.clear()` releases Draft Mode owned by this tool and returns to the default cache path. Existing CMS Draft sessions are preserved.
111
108
 
112
- 실제 production 빌드로 검증한 기준은 **Next.js 16.3.5 / App Router / Node 런타임**입니다. Pages Router, Edge, `output: 'export'`는 자동 연결 대상이 아닙니다. 직접 DB 조회, XHR·WebSocket, fetch를 거치지 않는 외부 캐시에도 별도 어댑터가 필요합니다. 캐시 내부의 요청 쿠키를 읽는 작은 Next 내부 브리지가 있어, Next 버전 업그레이드 시 production 회귀 테스트가 필요합니다. [동작 원리와 호환성](https://github.com/uiwwsw/next-test-mode/blob/main/docs/server-rendering.md).
109
+ Validated against **Next.js 16.4.2 / App Router / Node runtime** with real production builds. Pages Router, Edge and `output: 'export'` are outside automatic integration. Direct database reads, XHR, WebSocket and external caches that do not use fetch need adapters. A small bridge reads request cookies inside cached Next scopes; rerun production regression tests when upgrading Next. [How it works and compatibility](./docs/server-rendering.md).
113
110
 
114
111
  ## Console controls the server preview
115
112
 
116
- 콘솔에서 바꾼 값이 서버에서 렌더한 HTML까지 바뀌는 것이 핵심입니다. **데이터를 조작하지 않고 캐시만 우회해서 실제 응답을 다시 확인할 수도 있습니다.**
113
+ Mock and patch commands connect the preview automatically. You can also bypass caches to inspect fresh real data without changing it:
117
114
 
118
115
  ```js
119
- test.cache.bypass(); // 내 Next Draft 세션에서 새 서버 렌더. mock 없어도 사용 가능
120
- test.cache.status(); // 연결 상태, Draft 활성 여부, 미반영 변경, 오류 확인
121
- test.cache.refresh(); // 같은 값으로 다시 렌더
122
- test.cache.restore(); // 테스트 입력·시나리오·수동 우회 해제, 기본 캐시 경로 복귀
116
+ test.cache.bypass(); // Keep existing overrides and open a server preview
117
+ test.cache.status(); // Inspect Draft status, pending changes and errors
118
+ test.cache.refresh(); // Render again with the same values
119
+ test.cache.restore(); // Clear tests and return to the default cache path
123
120
  ```
124
121
 
125
- `bypass()`는 기존 mock/patch를 유지합니다. `refresh()`는 Draft가 켜져 있을 때 새 서버 렌더를 요청하며, 꺼져 있으면 기존 캐시 정책을 따릅니다.
126
-
127
- 일반 mock/patch는 캐시 우회를 자동으로 연결하므로 이 명령들을 따로 호출할 필요가 없습니다. `test.clear()`도 전체 테스트를 해제합니다. 초기화 시 기존 CMS Draft 세션은 유지합니다.
128
-
129
- **제어 범위는 내 브라우저 세션의 Next 렌더링·데이터 캐시 경로입니다.** 공용 캐시를 삭제하지 않으며, 브라우저 HTTP 캐시·SWR/React Query·Redis·외부 CDN을 일괄 무효화하지 않습니다. [캐시별 동작과 설계](https://github.com/uiwwsw/next-test-mode/blob/main/docs/concept.md).
122
+ `refresh()` requests a fresh server render while Draft Mode is active; otherwise the existing cache policy applies. `test.clear()` also ends all tests. These controls cover your session's Next rendering and data cache path, not shared cache deletion, browser HTTP caches, SWR/React Query, Redis or external CDNs. [Cache behavior and design](./docs/concept.md).
130
123
 
131
124
  ## Try once, or keep it in a folder
132
125
 
133
- **잠깐 확인할 테스트는 콘솔에서 끝내세요.** `test.mock()` / `test.patch()` → 화면 확인 → `test.clear()`. 임시 실험 때문에 파일이나 API 호출 코드를 고칠 필요가 없습니다.
126
+ For a one-off check, use `test.mock()` or `test.patch()`, inspect the page, then `test.clear()`. No temporary file or API call edits are needed.
134
127
 
135
- **반복할 테스트는 `init`이 생성한 `test-mode/catalog.ts`에서 관리하세요.**
136
-
137
- ```text
138
- src/
139
- api/cart.ts # 기존 API 호출
140
- test-mode/
141
- catalog.ts # 브라우저·서버에서 공유할 등록 목록
142
- features/cart.ts # API별 mock / patch와 데이터
143
- stories/cart.stories.ts # 여러 API를 묶은 화면 시나리오
144
- ```
128
+ Keep repeated tests in the generated `test-mode/catalog.ts` and split larger catalogs into feature and story files:
145
129
 
146
130
  ```ts
147
- // src/test-mode/catalog.ts
148
131
  import { defineMock } from '@uiwwsw/next-test-mode/core';
149
132
 
150
133
  export const catalog = {
@@ -158,22 +141,22 @@ export const catalog = {
158
141
  };
159
142
  ```
160
143
 
161
- 생성된 두 설치 파일이 같은 catalog를 자동으로 읽습니다. Console에서 `test.feat.add('/api/cart:empty')`로 선택하세요. 여러 API를 묶은 story도 `test.story('cart.empty')`로 활성화합니다. 서버에서도 쓸 정의에는 브라우저 전용 코드를 넣지 마세요.
144
+ Select this case with `test.feat.add('/api/cart:empty')`. Activate a story spanning multiple APIs with `test.story('cart.empty')`. Definitions used by the server must avoid browser-only code.
162
145
 
163
- `init`을 다시 실행해도 편집한 테스트 폴더를 덮어쓰지 않습니다. 0.5/0.6의 변경하지 않은 자동 생성 설정은 `init --migrate`로 옮길 수 있습니다. 사용자 코드가 섞인 연결 파일은 변경 없이 합칠 내용을 안내합니다.
146
+ Running `init` again preserves the edited test folder. `init --migrate` migrates unchanged generated 0.5/0.6 setup; customized integration files receive manual merge instructions. [Migration guide](./docs/migration.md).
164
147
 
165
148
  ## Details that matter
166
149
 
167
- - 직접 입력은 **GET + 정확한 pathname**에 매칭합니다. 다른 메서드는 `{ method: 'POST' }` 옵션으로 지정합니다. 여러 호스트의 같은 pathname은 함께 매칭됩니다.
168
- - `patch`는 실제 응답의 최상위 필드를 덮어씁니다. 중첩 객체와 배열은 통째로 교체되며, 실제 네트워크 요청은 실행됩니다. `mock`은 매칭된 요청의 응답을 직접 만듭니다.
169
- - 쿠키로 전달하는 전체 선택·JSON 상태는 URL 인코딩 후 **3,500바이트**까지입니다. 큰 응답은 작은 patch 또는 파일에 정의한 시나리오로 관리하세요. 브라우저 세션 복원 설정에 따라 쿠키도 복원될 수 있습니다.
170
- - Draft 연결 실패는 Console 오류와 `next-test-mode:error` 이벤트로 알리며 자동 새로고침하지 않습니다. `ready` / `sync()`로 성공 여부를 기다릴 수 있습니다. [클라이언트 API](https://github.com/uiwwsw/next-test-mode/blob/main/docs/server-rendering.md#클라이언트-연결-상태).
171
- - 테스트 쿠키는 로그인 자격이 아닙니다. QA 환경의 접근 권한은 앱이 관리합니다. 들어온 인증 쿠키를 외부 API에 자동 전달하지 않습니다.
172
- - 이 패키지는 **화면 상태를 재현하는 도구**입니다. 자동 assertion·합격 판정은 Playwright나 Vitest가 담당합니다.
150
+ - Direct overrides match **GET plus exact pathname** by default. Specify other methods with `{ method: 'POST' }`. Identical pathnames on different hosts match together.
151
+ - `patch` overwrites top-level fields of the real response. Nested objects and arrays are replaced as a whole; the network request still runs. `mock` supplies the matching response directly.
152
+ - The total URL-encoded cookie state is limited to **3,500 bytes**. Use a small patch or a file-defined scenario for larger responses. Browser session restoration may restore cookies too.
153
+ - Draft connection failures emit a console error and `next-test-mode:error`; they do not trigger a reload. Await `ready` or `sync()` to verify success. [Client API](./docs/server-rendering.md#클라이언트-연결-상태).
154
+ - Test cookies are not authentication. The application controls QA access. Incoming authentication cookies are not automatically forwarded to external APIs.
155
+ - This tool reproduces page states. Use Playwright or Vitest for automated assertions and pass/fail results.
173
156
 
174
157
  ## Framework-independent APIs
175
158
 
176
- 기존 범용 core·browser·Node API도 새 이름 아래 유지합니다. Next.js는 선택적 peer이며, 범용 API는 Next 없이 설치할 수 있습니다. 외부 런타임 의존성은 없습니다.
159
+ The core, browser and Node APIs remain available under the new package name. Next.js is an optional peer; generic APIs work without it. There are no external runtime dependencies.
177
160
 
178
161
  ```ts
179
162
  import { setupTestMode } from '@uiwwsw/next-test-mode';
@@ -183,19 +166,19 @@ import { withTestMode } from '@uiwwsw/next-test-mode/node';
183
166
  import { createServerTestMode } from '@uiwwsw/next-test-mode/server';
184
167
  ```
185
168
 
186
- 일반 브라우저 앱은 `setupTestMode({ enabled: true, refresh: () => refetch() })`를 시작 시 한 번 연결합니다. 이 범용 설정의 직접 JSON은 기본적으로 메모리에만 남습니다. Next에서는 Draft Mode를 연결하는 `init` 설정을 사용하세요. [전체 API 가이드](https://github.com/uiwwsw/next-test-mode/blob/main/docs/guide.md).
169
+ For a generic browser application, connect `setupTestMode({ enabled: true, refresh: () => refetch() })` once at startup. Direct JSON overrides stay in memory by default. Use the generated `init` integration for Next Draft Mode. [Full API guide](./docs/guide.md) (Korean).
187
170
 
188
171
  ## Develop & release
189
172
 
190
173
  ```bash
191
174
  npm ci
192
175
  npx playwright install chromium
193
- npm run ci # 타입, 런타임, tarball 설치와 소비자 타입 검사
194
- npm run test:browser # 브라우저 Console·fetch·Draft 연결
195
- npm run test:next # 실제 Next dev/production/Cache Components/비활성 배포
196
- npm run test:demo # 네 렌더 모드와 모바일 JSON 편집기
197
- npm run dev:demo # 실제 Next.js 데모
198
- npm run build:demo # Vercel 배포용 Next 빌드
176
+ npm run ci # Types, runtime tests, tarball installation and consumer types
177
+ npm run test:browser # Browser console, fetch and Draft integration
178
+ npm run test:next # Next dev, production, Cache Components and disabled builds
179
+ npm run test:demo # Rendering examples, localized SEO and mobile editor
180
+ npm run dev:demo # Next.js demo
181
+ npm run build:demo # Vercel production build
199
182
  ```
200
183
 
201
- 검증된 main의 릴리스 태그를 GitHub Release로 발행하면, CI를 다시 통과한 패키지가 `NPM_TOKEN`을 사용하는 Actions에서 npm provenance와 함께 배포됩니다. [배포 절차](https://github.com/uiwwsw/next-test-mode/blob/main/docs/releasing.md) · [설계](https://github.com/uiwwsw/next-test-mode/blob/main/docs/architecture.md) · [Changelog](https://github.com/uiwwsw/next-test-mode/blob/main/CHANGELOG.md).
184
+ A GitHub Release from a verified main tag triggers CI and npm publishing with provenance. Stable releases use `latest`. Version 1.0 retains the 0.7 public APIs. [Release process](./docs/releasing.md) · [Architecture](./docs/architecture.md) · [Changelog](./CHANGELOG.md).
@@ -77,7 +77,7 @@ The factory rejects calls in a browser before any state mutation. Call it inside
77
77
 
78
78
  `withTestMode(handler)` installs a dispatcher once and uses AsyncLocalStorage for each incoming Node request. Unchanged global fetch calls use that request's runtime; outside the scope they use the original transport. Response completion deactivates the scope. Active test responses receive private/no-store headers. Cleanup supports nested installs and preserves newer third-party hooks.
79
79
 
80
- `installServerTestMode({ getRequest })` supports frameworks with their own current-request accessor. A WeakMap keyed by request identity keeps selections and counters local. A fetch accessor follows later framework replacements, while function proxies preserve framework marker properties. AsyncLocalStorage bypasses recursive interception. `setupNextTestMode()` checks public `draftMode()` without opting ordinary requests into dynamic rendering. Active Draft sessions use a guarded read-only bridge into the internal provider cookie jar for request identity and test cookies, including inside cache scopes. This version-sensitive boundary is tested against Next 16.3.5; unsupported provider shapes throw. Startup and generateStaticParams fetches pass through. Override responses sit outside Next's fetch cache: mocked values never enter it, and patches only transform the returned response. Request-context errors that signal dynamic rendering are rethrown; unscoped startup fetches pass through.
80
+ `installServerTestMode({ getRequest })` supports frameworks with their own current-request accessor. A WeakMap keyed by request identity keeps selections and counters local. A fetch accessor follows later framework replacements, while function proxies preserve framework marker properties. AsyncLocalStorage bypasses recursive interception. `setupNextTestMode()` checks public `draftMode()` without opting ordinary requests into dynamic rendering. Active Draft sessions use a guarded read-only bridge into the internal provider cookie jar for request identity and test cookies, including inside cache scopes. This version-sensitive boundary is tested against Next 16.4.2; unsupported provider shapes throw. Startup and generateStaticParams fetches pass through. Override responses sit outside Next's fetch cache: mocked values never enter it, and patches only transform the returned response. Request-context errors that signal dynamic rendering are rethrown; unscoped startup fetches pass through.
81
81
 
82
82
  The new browser setup disables app-owned html/body dataset markers by default to avoid mutating React hydration attributes. The visible overlay still works. Low-level overlay defaults stay compatible; callers may explicitly set `datasetName` or false. Both setup and adapters are explicit installations with cleanup, not import-time hooks.
83
83
 
package/docs/migration.md CHANGED
@@ -15,7 +15,7 @@ npm run dev
15
15
 
16
16
  앱 소유의 시나리오 파일에 남은 import도 `@uiwwsw/test-mode`에서 `@uiwwsw/next-test-mode`로 바꾸세요. 새 브라우저 연결은 `/client`의 `setupNextTestModeClient`입니다. 기존 `setupTestMode({ ssr: true })`와 중복 설치하지 마세요. 서버는 `/next`의 `setupNextTestMode`를 사용합니다.
17
17
 
18
- Next.js 16.3.5 이상 17 미만의 App Router와 Node.js 20.9 이상이 필요합니다. 검증된 Next 버전은 16.3.5입니다. QA 배포는 `NEXT_PUBLIC_NEXT_TEST_MODE=1`을 빌드와 실행 환경에 설정하고 재배포하세요. Pages Router와 Edge, 순수 정적 export는 자동 이전 대상이 아닙니다.
18
+ Next.js 16.4.2 이상 17 미만의 App Router와 Node.js 20.9 이상이 필요합니다. 검증된 Next 버전은 16.4.2입니다. QA 배포는 `NEXT_PUBLIC_NEXT_TEST_MODE=1`을 빌드와 실행 환경에 설정하고 재배포하세요. Pages Router와 Edge, 순수 정적 export는 자동 이전 대상이 아닙니다.
19
19
 
20
20
  ## 유지되는 API
21
21
 
package/docs/releasing.md CHANGED
@@ -10,7 +10,7 @@ npm run test:demo
10
10
  npm pack
11
11
  ```
12
12
 
13
- PR/main CI는 Node.js 20.9 / 22 / 24, Chromium, 실제 Next.js 16.3.5를 검증합니다. tarball을 독립 앱에 설치해 ESM·타입·스타터·CLI를 확인합니다. Next fixture는 dev, production의 SSR·SSG·ISR·force-static·생성 경로·unstable_cache, Cache Components/use cache, 비활성 production을 각각 검사합니다. 테스트 카탈로그가 비활성 production의 브라우저·서버 번들에서 제외되는지, 첫 CSR fetch부터 가로채는지도 검사합니다. 공개 데모는 네 렌더 모드·모바일 JSON 입력·데이터 조작 없는 캐시 우회/복귀를 검사합니다.
13
+ PR/main CI는 Node.js 20.9 / 22 / 24, Chromium, 실제 Next.js 16.4.2를 검증합니다. tarball을 독립 앱에 설치해 ESM·타입·스타터·CLI를 확인합니다. Next fixture는 dev, production의 SSR·SSG·ISR·force-static·생성 경로·unstable_cache, Cache Components/use cache, 비활성 production을 각각 검사합니다. 테스트 카탈로그가 비활성 production의 브라우저·서버 번들에서 제외되는지, 첫 CSR fetch부터 가로채는지도 검사합니다. 공개 데모는 단일 콘솔 테스트 흐름·모바일 JSON 입력·언어 전환을 검사하며, 기존 렌더 경로와 캐시 우회/복귀는 회귀 검증으로 유지합니다.
14
14
 
15
15
  ## npm
16
16
 
@@ -22,7 +22,7 @@ GitHub Release 발행 또는 Publish workflow에서 기존 tag를 지정하면
22
22
  4. 전체 CI, 태그·버전 일치, main 포함 여부를 통과하면 npm provenance와 함께 발행합니다.
23
23
  5. 레지스트리에서 버전·커밋·무결성·provenance와 실제 설치에 사용하는 패키지 목록·배포 태그까지 확인한 다음, 기존 패키지에 새 이름과 이전 가이드를 안내합니다. 기존 버전은 삭제하지 않습니다.
24
24
 
25
- 정식 버전은 `latest`, 사전 버전은 `next` 채널로 배포합니다. 동일 커밋으로 이미 발행했다면 건너뛰며, 다른 커밋의 동일 버전은 거부합니다. 레지스트리 반영은 최대 36회 재시도합니다. 성공 후 일반 `npm view`와 새 소비자 설치로도 확인하세요.
25
+ 정식 버전은 `latest`, 사전 버전은 `next` 채널로 배포합니다. 동일 커밋으로 이미 발행했다면 건너뛰며, 다른 커밋의 동일 버전은 거부합니다. 구 패키지의 모든 버전에 이전 안내가 이미 등록돼 있으면 해당 쓰기 작업도 건너뜁니다. 레지스트리 반영은 최대 36회 재시도합니다. 성공 후 일반 `npm view`와 새 소비자 설치로도 확인하세요.
26
26
 
27
27
  npm [Trusted publishing](https://docs.npmjs.com/trusted-publishers/)을 설정한다면 GitHub user `uiwwsw`, repository **`next-test-mode`**, workflow `publish.yml`, environment `npm`을 사용합니다. 워크플로의 OIDC 권한은 준비되어 있습니다.
28
28
 
@@ -39,3 +39,12 @@ npm [Trusted publishing](https://docs.npmjs.com/trusted-publishers/)을 설정
39
39
  ## 문서 이미지
40
40
 
41
41
  `npm run docs:assets`는 Next production 데모를 Chromium으로 촬영하고 README의 PNG/GIF를 만듭니다. Python 3과 Pillow가 필요합니다. 이미지는 GitHub 릴리스 태그의 절대 URL로 제공하며 npm tarball에는 넣지 않습니다. README 이미지 URL의 태그도 새 릴리스에 맞추세요.
42
+
43
+
44
+ ## 다국어와 검색 메타데이터
45
+
46
+ 기본 URL은 한국어, `/en`은 영어입니다. 두 locale은 동일한 Playground와 테스트 API를 공유합니다. 렌더 예제별로 canonical·ko/en/x-default alternate·Open Graph·Twitter 메타데이터를 서버 HTML에 생성하며 루트 레이아웃의 `lang`도 각각 유지합니다. `app/robots.js`와 `app/sitemap.js`가 크롤링 경로를 제공합니다. 배포 후 `/`, `/en`, `/sitemap.xml`, `/robots.txt`, `/social-card.png`의 공개 응답을 확인하세요.
47
+
48
+ README.md는 영어, README.ko.md는 한국어이며 모두 npm 패키지에 포함됩니다. 공유 이미지는 커밋된 `docs/assets/social-card.png`에서 배포 시 복사합니다. `npm run docs:assets`로 촬영 후 이미지도 함께 커밋하세요. Google Search Console의 sitemap 제출과 색인 현황은 사이트 소유자 계정에서 별도로 확인할 수 있습니다.
49
+
50
+ 워크스페이스에서는 `devctl doctor next-test-mode`, `devctl deploy next-test-mode`로 계획을 확인한 뒤 `devctl deploy next-test-mode --execute`로 연결된 기존 Vercel 프로젝트에 배포합니다. 공개 URL healthcheck가 모두 통과해야 완료입니다.
@@ -76,7 +76,7 @@ Worker는 서버의 fetch를 가로챌 수 없으므로 이 연결을 대체하
76
76
  | `generateStaticParams` | 생성된 경로의 페이지 데이터 미리보기 | 빌드 시 매개변수 목록은 콘솔로 재생성하지 않음 |
77
77
  | `unstable_cache` / `use cache` | Draft의 캐시 우회 중 실행하는 fetch 변경 | 사용자 정의 외부 캐시·직접 DB 호출까지 가로채지 않음 |
78
78
 
79
- App Router의 **Next.js 16.3.5, Node.js 20.9 이상**을 기준으로 검증했습니다. 패키지의 Next peer 범위는 `>=16.3.5 <17`입니다. 그 범위의 모든 향후 버전을 검증했다는 뜻은 아닙니다. **Pages Router, Edge, `output: 'export'`는 자동 연결 대상이 아닙니다.** 정적 export에는 Draft 쿠키를 만들고 페이지를 다시 렌더할 서버가 없습니다.
79
+ App Router의 **Next.js 16.4.2, Node.js 20.9 이상**을 기준으로 검증했습니다. 패키지의 Next peer 범위는 `>=16.4.2 <17`입니다. 그 범위의 모든 향후 버전을 검증했다는 뜻은 아닙니다. **Pages Router, Edge, `output: 'export'`는 자동 연결 대상이 아닙니다.** 정적 export에는 Draft 쿠키를 만들고 페이지를 다시 렌더할 서버가 없습니다.
80
80
 
81
81
  이미 CMS가 켜 둔 Draft 세션은 `test.clear()`로 종료하지 않습니다. 도구가 처음 연 세션만 소유 표시 쿠키로 추적합니다. CMS와 같은 브라우저에서 테스트 중 CMS가 세션의 소유권을 바꾸는 복잡한 흐름에는 앱이 별도 세션 정책을 정해야 합니다.
82
82
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uiwwsw/next-test-mode",
3
- "version": "0.7.0",
4
- "description": "Console-first Next.js test mode: keep fetch calls unchanged and preview CSR, SSR, ISR and SSG with session-isolated Draft Mode.",
3
+ "version": "1.0.1",
4
+ "description": "Test fetch data and page states from the console, including session-scoped previews of server-rendered and static Next.js pages.",
5
5
  "type": "module",
6
6
  "packageManager": "npm@11.16.0",
7
7
  "license": "MIT",
@@ -15,7 +15,8 @@
15
15
  "templates/test-mode",
16
16
  "CHANGELOG.md",
17
17
  "LICENSE",
18
- "README.md"
18
+ "README.md",
19
+ "README.ko.md"
19
20
  ],
20
21
  "exports": {
21
22
  ".": {
@@ -117,13 +118,13 @@
117
118
  "@types/node": "18.19.130",
118
119
  "@types/react": "19.3.0",
119
120
  "@types/react-dom": "19.3.0",
120
- "next": "16.3.5",
121
+ "next": "16.4.2",
121
122
  "react": "19.3.0",
122
123
  "react-dom": "19.3.0",
123
124
  "typescript": "5.9.3"
124
125
  },
125
126
  "peerDependencies": {
126
- "next": ">=16.3.5 <17"
127
+ "next": ">=16.4.2 <17"
127
128
  },
128
129
  "peerDependenciesMeta": {
129
130
  "next": {