From f0a93217a7c7e8530d5d2d83dc75b3684fca9d16 Mon Sep 17 00:00:00 2001
From: Park Sangwoo <49917043+SangWoo9734@users.noreply.github.com>
Date: Tue, 10 Dec 2024 19:55:38 +0900
Subject: [PATCH 01/16] =?UTF-8?q?docs:=20PR=20=ED=83=AC=ED=94=8C=EB=A6=BF?=
=?UTF-8?q?=20=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/pull_request_template | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 .github/pull_request_template
diff --git a/.github/pull_request_template b/.github/pull_request_template
new file mode 100644
index 0000000..1abcb84
--- /dev/null
+++ b/.github/pull_request_template
@@ -0,0 +1,15 @@
+- 제목 : [Task ID]: 기능명
+ ex) [TSK-11] 로그인 페이지 구현
+ (확인 후 지워주세요)
+
+## 📝 작업 내용
+
+> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)
+
+## 📸 스크린샷 (선택)
+
+## 💬 리뷰 요구사항(선택)
+
+> 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
+>
+> ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?
From fb1b34cb0d2392975e4df27785fe5fa9d7741e13 Mon Sep 17 00:00:00 2001
From: Park Sangwoo <49917043+SangWoo9734@users.noreply.github.com>
Date: Thu, 12 Dec 2024 00:22:00 +0900
Subject: [PATCH 02/16] =?UTF-8?q?docks:=20PR=20=ED=85=9C=ED=94=8C=EB=A6=BF?=
=?UTF-8?q?=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/pull_request_template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/pull_request_template b/.github/pull_request_template
index 1abcb84..1fe014f 100644
--- a/.github/pull_request_template
+++ b/.github/pull_request_template
@@ -1,5 +1,5 @@
- 제목 : [Task ID]: 기능명
- ex) [TSK-11] 로그인 페이지 구현
+ ex) [TASK-11] 로그인 페이지 구현
(확인 후 지워주세요)
## 📝 작업 내용
From 52614bfec3dd5db278a81c95b015f20e211a0cc1 Mon Sep 17 00:00:00 2001
From: Dahyeon Jin <154739298+dahyeo-n@users.noreply.github.com>
Date: Sat, 14 Dec 2024 06:28:53 +0900
Subject: [PATCH 03/16] =?UTF-8?q?docs:=20PR=20=ED=85=9C=ED=94=8C=EB=A6=BF?=
=?UTF-8?q?=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/pull_request_template | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/pull_request_template b/.github/pull_request_template
index 1fe014f..7d88b77 100644
--- a/.github/pull_request_template
+++ b/.github/pull_request_template
@@ -1,15 +1,12 @@
-- 제목 : [Task ID]: 기능명
- ex) [TASK-11] 로그인 페이지 구현
- (확인 후 지워주세요)
+🚨 제목: [TASK-ID] 라벨: 기능명
+ ex. [TASK-11] feat: 로그인 페이지 구현 (확인 후 지워주세요)
## 📝 작업 내용
-> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)
+> 이번 PR에서 작업한 내용과 이유를 간략히 설명해주세요 (이미지 첨부 가능)
## 📸 스크린샷 (선택)
-## 💬 리뷰 요구사항(선택)
+## 💬 리뷰 요구사항 (선택)
-> 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
->
-> ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?
+> 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 (ex. 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?)
From 87e2406ae2ed577474de781a4e1049bde3ae9a6b Mon Sep 17 00:00:00 2001
From: Dahyeon Jin <154739298+dahyeo-n@users.noreply.github.com>
Date: Sat, 14 Dec 2024 06:44:13 +0900
Subject: [PATCH 04/16] =?UTF-8?q?docs:=20README=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 40 +++++++++++++---------------------------
1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
index e215bc4..b120a8f 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,22 @@
-This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
+
+
Momentia (모멘티아)
+
+
-## Getting Started
+## 배포 주소
-First, run the development server:
+*** 추후 추가 예정 ***
-```bash
-npm run dev
-# or
-yarn dev
-# or
-pnpm dev
-# or
-bun dev
-```
-
-Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
-
-You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
+## 0. 프로젝트 소개
-This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
+> 개발 기간: 2024. 12. 5 ~
-## Learn More
+모멘티아는 '**무명 예술가를 위한 작품 전시/판매 플랫폼**'입니다.
-To learn more about Next.js, take a look at the following resources:
+## 폴더 구조
-- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
-- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
+*** 깔끔히 정리해서 추가할 예정 ***
-You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
-
-## Deploy on Vercel
-
-The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
+```bash
-Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
+```
From 2791f0c7fe3722e1e6b79a08a6c875e0346d48df Mon Sep 17 00:00:00 2001
From: Dahyeon Jin <154739298+dahyeo-n@users.noreply.github.com>
Date: Sat, 14 Dec 2024 11:46:03 +0900
Subject: [PATCH 05/16] =?UTF-8?q?docs:=20lint-build-test.yml=20=EC=83=9D?=
=?UTF-8?q?=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/lint-build-test.yml | 71 +++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 .github/workflows/lint-build-test.yml
diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml
new file mode 100644
index 0000000..8688a88
--- /dev/null
+++ b/.github/workflows/lint-build-test.yml
@@ -0,0 +1,71 @@
+name: Lint, Build, and Test
+
+on:
+ push:
+ branches: ["main", "dev"]
+ pull_request:
+ branches: ["main", "dev"]
+
+jobs:
+ lint-build-test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Cache Node Modules
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.pnpm-store
+ node_modules
+ key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-node-
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 18
+
+ - name: Setup pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: Install dependencies
+ run: pnpm install
+
+ - name: Run Lint
+ run: pnpm lint
+
+ - name: Prettier Check
+ run: pnpm prettier --check .
+
+ - name: Build
+ if: success()
+ run: pnpm build
+
+ - name: Run Tests
+ if: success()
+ run: pnpm test -- --ci
+
+ - name: Notify Discord on Failure
+ if: failure()
+ uses: johnnyhuy/actions-discord-git-webhook@main
+ with:
+ webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
+ message: |
+ 🚨 **Lint/Build/Test Workflow 실패** 🚨
+
+ **Repository**: ${{ github.repository }}
+ **Branch**: ${{ github.ref_name }}
+ **Commit**: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
+ **Author**: ${{ github.actor }}
+ **Job**: ${{ github.job }}
+
+ ❗ 자세한 내용은 [GitHub Actions Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})를 확인하세요.
+
+ ---
+ 🕒 **Timestamp**: ${{ github.event.head_commit.timestamp }}
From 1618f5da56d8d58760cd84aaef730d2f6dbd65f4 Mon Sep 17 00:00:00 2001
From: Dahyeon Jin <154739298+dahyeo-n@users.noreply.github.com>
Date: Sat, 14 Dec 2024 12:18:59 +0900
Subject: [PATCH 06/16] =?UTF-8?q?docs:=20lint-build-test.yml=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/lint-build-test.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml
index 8688a88..19b781e 100644
--- a/.github/workflows/lint-build-test.yml
+++ b/.github/workflows/lint-build-test.yml
@@ -8,7 +8,7 @@ on:
jobs:
lint-build-test:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04
steps:
- name: Checkout code
@@ -56,7 +56,7 @@ jobs:
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
- message: |
+ args: |
🚨 **Lint/Build/Test Workflow 실패** 🚨
**Repository**: ${{ github.repository }}
From 3f917a6436960b5de52f2bfdf9f18ee9a59e3024 Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Mon, 16 Dec 2024 11:32:58 +0900
Subject: [PATCH 07/16] =?UTF-8?q?setting=20:=20MSW=20=EC=82=AC=EC=9A=A9=20?=
=?UTF-8?q?=EA=B4=80=EB=A0=A8=20=ED=99=98=EA=B2=BD=20=EC=84=B8=ED=8C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 6 +
public/mockServiceWorker.js | 307 ++++++++++++++++++++++++++++++
src/app/layout.tsx | 5 +-
src/app/providers/MSWProvider.tsx | 19 ++
src/mocks/browser.ts | 3 +
src/mocks/handlers.ts | 10 +
src/mocks/index.ts | 9 +
src/mocks/server.ts | 4 +
8 files changed, 362 insertions(+), 1 deletion(-)
create mode 100644 public/mockServiceWorker.js
create mode 100644 src/app/providers/MSWProvider.tsx
create mode 100644 src/mocks/browser.ts
create mode 100644 src/mocks/handlers.ts
create mode 100644 src/mocks/index.ts
create mode 100644 src/mocks/server.ts
diff --git a/package.json b/package.json
index e3eefbf..787dbc4 100644
--- a/package.json
+++ b/package.json
@@ -32,9 +32,15 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
+ "msw": "^2.6.8",
"postcss": "^8.4.49",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.16",
"typescript": "^5.7.2"
+ },
+ "msw": {
+ "workerDirectory": [
+ "public"
+ ]
}
}
diff --git a/public/mockServiceWorker.js b/public/mockServiceWorker.js
new file mode 100644
index 0000000..dbc5b1d
--- /dev/null
+++ b/public/mockServiceWorker.js
@@ -0,0 +1,307 @@
+/* eslint-disable */
+/* tslint:disable */
+
+/**
+ * Mock Service Worker.
+ * @see https://github.com/mswjs/msw
+ * - Please do NOT modify this file.
+ * - Please do NOT serve this file on production.
+ */
+
+const PACKAGE_VERSION = '2.6.8'
+const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
+const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
+const activeClientIds = new Set()
+
+self.addEventListener('install', function () {
+ self.skipWaiting()
+})
+
+self.addEventListener('activate', function (event) {
+ event.waitUntil(self.clients.claim())
+})
+
+self.addEventListener('message', async function (event) {
+ const clientId = event.source.id
+
+ if (!clientId || !self.clients) {
+ return
+ }
+
+ const client = await self.clients.get(clientId)
+
+ if (!client) {
+ return
+ }
+
+ const allClients = await self.clients.matchAll({
+ type: 'window',
+ })
+
+ switch (event.data) {
+ case 'KEEPALIVE_REQUEST': {
+ sendToClient(client, {
+ type: 'KEEPALIVE_RESPONSE',
+ })
+ break
+ }
+
+ case 'INTEGRITY_CHECK_REQUEST': {
+ sendToClient(client, {
+ type: 'INTEGRITY_CHECK_RESPONSE',
+ payload: {
+ packageVersion: PACKAGE_VERSION,
+ checksum: INTEGRITY_CHECKSUM,
+ },
+ })
+ break
+ }
+
+ case 'MOCK_ACTIVATE': {
+ activeClientIds.add(clientId)
+
+ sendToClient(client, {
+ type: 'MOCKING_ENABLED',
+ payload: {
+ client: {
+ id: client.id,
+ frameType: client.frameType,
+ },
+ },
+ })
+ break
+ }
+
+ case 'MOCK_DEACTIVATE': {
+ activeClientIds.delete(clientId)
+ break
+ }
+
+ case 'CLIENT_CLOSED': {
+ activeClientIds.delete(clientId)
+
+ const remainingClients = allClients.filter((client) => {
+ return client.id !== clientId
+ })
+
+ // Unregister itself when there are no more clients
+ if (remainingClients.length === 0) {
+ self.registration.unregister()
+ }
+
+ break
+ }
+ }
+})
+
+self.addEventListener('fetch', function (event) {
+ const { request } = event
+
+ // Bypass navigation requests.
+ if (request.mode === 'navigate') {
+ return
+ }
+
+ // Opening the DevTools triggers the "only-if-cached" request
+ // that cannot be handled by the worker. Bypass such requests.
+ if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
+ return
+ }
+
+ // Bypass all requests when there are no active clients.
+ // Prevents the self-unregistered worked from handling requests
+ // after it's been deleted (still remains active until the next reload).
+ if (activeClientIds.size === 0) {
+ return
+ }
+
+ // Generate unique request ID.
+ const requestId = crypto.randomUUID()
+ event.respondWith(handleRequest(event, requestId))
+})
+
+async function handleRequest(event, requestId) {
+ const client = await resolveMainClient(event)
+ const response = await getResponse(event, client, requestId)
+
+ // Send back the response clone for the "response:*" life-cycle events.
+ // Ensure MSW is active and ready to handle the message, otherwise
+ // this message will pend indefinitely.
+ if (client && activeClientIds.has(client.id)) {
+ ;(async function () {
+ const responseClone = response.clone()
+
+ sendToClient(
+ client,
+ {
+ type: 'RESPONSE',
+ payload: {
+ requestId,
+ isMockedResponse: IS_MOCKED_RESPONSE in response,
+ type: responseClone.type,
+ status: responseClone.status,
+ statusText: responseClone.statusText,
+ body: responseClone.body,
+ headers: Object.fromEntries(responseClone.headers.entries()),
+ },
+ },
+ [responseClone.body],
+ )
+ })()
+ }
+
+ return response
+}
+
+// Resolve the main client for the given event.
+// Client that issues a request doesn't necessarily equal the client
+// that registered the worker. It's with the latter the worker should
+// communicate with during the response resolving phase.
+async function resolveMainClient(event) {
+ const client = await self.clients.get(event.clientId)
+
+ if (activeClientIds.has(event.clientId)) {
+ return client
+ }
+
+ if (client?.frameType === 'top-level') {
+ return client
+ }
+
+ const allClients = await self.clients.matchAll({
+ type: 'window',
+ })
+
+ return allClients
+ .filter((client) => {
+ // Get only those clients that are currently visible.
+ return client.visibilityState === 'visible'
+ })
+ .find((client) => {
+ // Find the client ID that's recorded in the
+ // set of clients that have registered the worker.
+ return activeClientIds.has(client.id)
+ })
+}
+
+async function getResponse(event, client, requestId) {
+ const { request } = event
+
+ // Clone the request because it might've been already used
+ // (i.e. its body has been read and sent to the client).
+ const requestClone = request.clone()
+
+ function passthrough() {
+ // Cast the request headers to a new Headers instance
+ // so the headers can be manipulated with.
+ const headers = new Headers(requestClone.headers)
+
+ // Remove the "accept" header value that marked this request as passthrough.
+ // This prevents request alteration and also keeps it compliant with the
+ // user-defined CORS policies.
+ const acceptHeader = headers.get('accept')
+ if (acceptHeader) {
+ const values = acceptHeader.split(',').map((value) => value.trim())
+ const filteredValues = values.filter(
+ (value) => value !== 'msw/passthrough',
+ )
+
+ if (filteredValues.length > 0) {
+ headers.set('accept', filteredValues.join(', '))
+ } else {
+ headers.delete('accept')
+ }
+ }
+
+ return fetch(requestClone, { headers })
+ }
+
+ // Bypass mocking when the client is not active.
+ if (!client) {
+ return passthrough()
+ }
+
+ // Bypass initial page load requests (i.e. static assets).
+ // The absence of the immediate/parent client in the map of the active clients
+ // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
+ // and is not ready to handle requests.
+ if (!activeClientIds.has(client.id)) {
+ return passthrough()
+ }
+
+ // Notify the client that a request has been intercepted.
+ const requestBuffer = await request.arrayBuffer()
+ const clientMessage = await sendToClient(
+ client,
+ {
+ type: 'REQUEST',
+ payload: {
+ id: requestId,
+ url: request.url,
+ mode: request.mode,
+ method: request.method,
+ headers: Object.fromEntries(request.headers.entries()),
+ cache: request.cache,
+ credentials: request.credentials,
+ destination: request.destination,
+ integrity: request.integrity,
+ redirect: request.redirect,
+ referrer: request.referrer,
+ referrerPolicy: request.referrerPolicy,
+ body: requestBuffer,
+ keepalive: request.keepalive,
+ },
+ },
+ [requestBuffer],
+ )
+
+ switch (clientMessage.type) {
+ case 'MOCK_RESPONSE': {
+ return respondWithMock(clientMessage.data)
+ }
+
+ case 'PASSTHROUGH': {
+ return passthrough()
+ }
+ }
+
+ return passthrough()
+}
+
+function sendToClient(client, message, transferrables = []) {
+ return new Promise((resolve, reject) => {
+ const channel = new MessageChannel()
+
+ channel.port1.onmessage = (event) => {
+ if (event.data && event.data.error) {
+ return reject(event.data.error)
+ }
+
+ resolve(event.data)
+ }
+
+ client.postMessage(
+ message,
+ [channel.port2].concat(transferrables.filter(Boolean)),
+ )
+ })
+}
+
+async function respondWithMock(response) {
+ // Setting response status code to 0 is a no-op.
+ // However, when responding with a "Response.error()", the produced Response
+ // instance will have status code set to 0. Since it's not possible to create
+ // a Response instance with status code 0, handle that use-case separately.
+ if (response.status === 0) {
+ return Response.error()
+ }
+
+ const mockedResponse = new Response(response.body, response)
+
+ Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
+ value: true,
+ enumerable: true,
+ })
+
+ return mockedResponse
+}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 4e3ff78..2c4a5f6 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -2,6 +2,7 @@ import type { Metadata } from 'next';
import React from 'react';
import '../styles/globals.css';
import ReactQueryProvider from './ReactQueryProvider';
+import MSWProvider from './providers/MSWProvider';
export const metadata: Metadata = {
title: '',
@@ -16,7 +17,9 @@ export default function RootLayout({
return (
- {children}
+
+ {children}
+
);
diff --git a/src/app/providers/MSWProvider.tsx b/src/app/providers/MSWProvider.tsx
new file mode 100644
index 0000000..b612bca
--- /dev/null
+++ b/src/app/providers/MSWProvider.tsx
@@ -0,0 +1,19 @@
+'use client';
+
+import { ReactNode, useEffect, useState } from 'react';
+
+export default function MSWProvider({ children }: { children: ReactNode }) {
+ const [mswReady, setMswReady] = useState(false);
+ useEffect(() => {
+ const init = async () => {
+ const initMsw = await import('@/mocks').then((res) => res.initMsw);
+ await initMsw();
+ setMswReady(true);
+ };
+
+ if (!mswReady) {
+ init();
+ }
+ }, [mswReady]);
+ return <>{children}>;
+}
diff --git a/src/mocks/browser.ts b/src/mocks/browser.ts
new file mode 100644
index 0000000..7e37d74
--- /dev/null
+++ b/src/mocks/browser.ts
@@ -0,0 +1,3 @@
+import { setupWorker } from 'msw/browser';
+import { handlers } from './handlers';
+export const worker = setupWorker(...handlers);
diff --git a/src/mocks/handlers.ts b/src/mocks/handlers.ts
new file mode 100644
index 0000000..27bea86
--- /dev/null
+++ b/src/mocks/handlers.ts
@@ -0,0 +1,10 @@
+import { USER } from '@/constants/API';
+import { http, HttpResponse } from 'msw';
+
+export const handlers = [
+ http.get(USER.validateEmail, () => {
+ return new HttpResponse(null, {
+ status: 204,
+ });
+ }),
+];
diff --git a/src/mocks/index.ts b/src/mocks/index.ts
new file mode 100644
index 0000000..1a985e2
--- /dev/null
+++ b/src/mocks/index.ts
@@ -0,0 +1,9 @@
+export async function initMsw() {
+ if (typeof window === 'undefined') {
+ const { server } = await import('./server');
+ server.listen();
+ } else {
+ const { worker } = await import('./browser');
+ await worker.start();
+ }
+}
diff --git a/src/mocks/server.ts b/src/mocks/server.ts
new file mode 100644
index 0000000..e975e12
--- /dev/null
+++ b/src/mocks/server.ts
@@ -0,0 +1,4 @@
+import { setupServer } from 'msw/node';
+import { handlers } from './handlers'; // 요청 핸들러 정의 파일 (필요 시 경로 수정)
+
+export const server = setupServer(...handlers);
From ae4a6840ff98a7b4652cd3128dec4db6250752d8 Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Mon, 16 Dec 2024 11:33:43 +0900
Subject: [PATCH 08/16] =?UTF-8?q?feat:=20axios=20client=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apis/index.ts | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 src/apis/index.ts
diff --git a/src/apis/index.ts b/src/apis/index.ts
new file mode 100644
index 0000000..0e70340
--- /dev/null
+++ b/src/apis/index.ts
@@ -0,0 +1,11 @@
+import axios from 'axios';
+
+const defaultClient = axios.create({
+ baseURL: process.env.NEXT_PUBLIC_API_BASE_URL,
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json',
+ },
+});
+
+export default defaultClient;
From 7edc7a24285473066ba64daac76ff72570f8f65e Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Mon, 16 Dec 2024 17:05:17 +0900
Subject: [PATCH 09/16] =?UTF-8?q?setting=20:=20MSW=20=EB=B2=84=EC=A0=84=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 787dbc4..fc3d48b 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
- "msw": "^2.6.8",
+ "msw": "^2.6.9",
"postcss": "^8.4.49",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.16",
From e2319150e6a6ca5890a57b6d85afd6945ef68139 Mon Sep 17 00:00:00 2001
From: Park Sangwoo <49917043+SangWoo9734@users.noreply.github.com>
Date: Mon, 16 Dec 2024 17:48:46 +0900
Subject: [PATCH 10/16] =?UTF-8?q?docs:=20auto=5Flabeling.yml=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/auto_labeling.yml | 57 +++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 .github/workflows/auto_labeling.yml
diff --git a/.github/workflows/auto_labeling.yml b/.github/workflows/auto_labeling.yml
new file mode 100644
index 0000000..4ff37d1
--- /dev/null
+++ b/.github/workflows/auto_labeling.yml
@@ -0,0 +1,57 @@
+name: Auto Label PR
+
+on:
+ pull_request:
+ types: [opened, edited, synchronize]
+
+jobs:
+ auto-label:
+ runs-on: ubuntu-latest
+
+ steps:
+ # PR 이벤트 트리거
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ # 커밋 메시지 키워드에 따라 라벨 추가
+ - name: Add labels based on commit messages
+ uses: actions/github-script@v6
+ with:
+ script: |
+ const commitKeywords = {
+ feat: 'feature',
+ fix: 'bug',
+ chore: 'chore',
+ docs: 'documentation',
+ style: 'style',
+ refactor: 'refactor',
+ test: 'test',
+ perf: 'performance',
+ };
+
+ const { context } = require('@actions/github');
+ const { commits } = context.payload.pull_request;
+
+ // 커밋 메시지에서 키워드 추출
+ const labelsToAdd = new Set();
+
+ commits.forEach(commit => {
+ const message = commit.commit.message;
+ const keyword = message.split(':')[0].trim();
+ if (commitKeywords[keyword]) {
+ labelsToAdd.add(commitKeywords[keyword]);
+ }
+ });
+
+ // 라벨 추가 요청
+ if (labelsToAdd.size > 0) {
+ const response = await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ labels: [...labelsToAdd],
+ });
+ console.log('Labels added:', response.data);
+ } else {
+ console.log('No matching labels found for commits.');
+ }
From 5b0921feceff8b9227ccfe78425dc5af9d1d2d70 Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Tue, 17 Dec 2024 18:05:24 +0900
Subject: [PATCH 11/16] =?UTF-8?q?chore:=20=EB=94=B0=EC=98=B4=ED=91=9C=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/layout.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 2c4a5f6..1a3ae00 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -15,7 +15,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
-
+
{children}
From 3b5cabacbd3b238495633eb98372807d1ac5be14 Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Tue, 17 Dec 2024 18:06:17 +0900
Subject: [PATCH 12/16] =?UTF-8?q?chore:=20=EC=BB=B4=ED=8F=AC=EB=84=8C?=
=?UTF-8?q?=ED=8A=B8=20=ED=95=A8=EC=88=98=20=ED=8F=AC=EB=A9=A7=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/providers/MSWProvider.tsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/app/providers/MSWProvider.tsx b/src/app/providers/MSWProvider.tsx
index b612bca..e37802d 100644
--- a/src/app/providers/MSWProvider.tsx
+++ b/src/app/providers/MSWProvider.tsx
@@ -2,8 +2,9 @@
import { ReactNode, useEffect, useState } from 'react';
-export default function MSWProvider({ children }: { children: ReactNode }) {
+const MSWProvider = ({ children }: { children: ReactNode }) => {
const [mswReady, setMswReady] = useState(false);
+
useEffect(() => {
const init = async () => {
const initMsw = await import('@/mocks').then((res) => res.initMsw);
@@ -15,5 +16,8 @@ export default function MSWProvider({ children }: { children: ReactNode }) {
init();
}
}, [mswReady]);
+
return <>{children}>;
-}
+};
+
+export default MSWProvider;
From 132ba7f083e7b2b95df0723332400c1b4d67a137 Mon Sep 17 00:00:00 2001
From: Park Sangwoo <49917043+SangWoo9734@users.noreply.github.com>
Date: Mon, 16 Dec 2024 17:48:46 +0900
Subject: [PATCH 13/16] =?UTF-8?q?docs:=20auto=5Flabeling.yml=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/auto_labeling.yml | 57 +++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 .github/workflows/auto_labeling.yml
diff --git a/.github/workflows/auto_labeling.yml b/.github/workflows/auto_labeling.yml
new file mode 100644
index 0000000..4ff37d1
--- /dev/null
+++ b/.github/workflows/auto_labeling.yml
@@ -0,0 +1,57 @@
+name: Auto Label PR
+
+on:
+ pull_request:
+ types: [opened, edited, synchronize]
+
+jobs:
+ auto-label:
+ runs-on: ubuntu-latest
+
+ steps:
+ # PR 이벤트 트리거
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ # 커밋 메시지 키워드에 따라 라벨 추가
+ - name: Add labels based on commit messages
+ uses: actions/github-script@v6
+ with:
+ script: |
+ const commitKeywords = {
+ feat: 'feature',
+ fix: 'bug',
+ chore: 'chore',
+ docs: 'documentation',
+ style: 'style',
+ refactor: 'refactor',
+ test: 'test',
+ perf: 'performance',
+ };
+
+ const { context } = require('@actions/github');
+ const { commits } = context.payload.pull_request;
+
+ // 커밋 메시지에서 키워드 추출
+ const labelsToAdd = new Set();
+
+ commits.forEach(commit => {
+ const message = commit.commit.message;
+ const keyword = message.split(':')[0].trim();
+ if (commitKeywords[keyword]) {
+ labelsToAdd.add(commitKeywords[keyword]);
+ }
+ });
+
+ // 라벨 추가 요청
+ if (labelsToAdd.size > 0) {
+ const response = await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ labels: [...labelsToAdd],
+ });
+ console.log('Labels added:', response.data);
+ } else {
+ console.log('No matching labels found for commits.');
+ }
From 355d1241e5a4ec6cbc9641780847f87a0cb1ed70 Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Tue, 17 Dec 2024 18:49:58 +0900
Subject: [PATCH 14/16] =?UTF-8?q?setting=20:=20MSW=20=EB=B2=84=EC=A0=84=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/mockServiceWorker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/mockServiceWorker.js b/public/mockServiceWorker.js
index dbc5b1d..2c0b0fb 100644
--- a/public/mockServiceWorker.js
+++ b/public/mockServiceWorker.js
@@ -8,7 +8,7 @@
* - Please do NOT serve this file on production.
*/
-const PACKAGE_VERSION = '2.6.8'
+const PACKAGE_VERSION = '2.6.9'
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()
From 0b95acc1ee274c418bff6f78cb001d72b986ab3a Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Tue, 17 Dec 2024 20:17:38 +0900
Subject: [PATCH 15/16] =?UTF-8?q?chore:=20Import=20=EA=B5=AC=EB=B6=84=20?=
=?UTF-8?q?=EA=B3=B5=EB=B0=B1=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/layout.tsx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 1a3ae00..68bd9c0 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,6 +1,9 @@
import type { Metadata } from 'next';
import React from 'react';
+
import '../styles/globals.css';
+
+import MSWProvider from './providers/MSWProvider';
import ReactQueryProvider from './ReactQueryProvider';
import MSWProvider from './providers/MSWProvider';
From 81aeb04cef8e53567641aaa55c158ea2389607e1 Mon Sep 17 00:00:00 2001
From: Parksangwoo
Date: Wed, 18 Dec 2024 02:27:46 +0900
Subject: [PATCH 16/16] =?UTF-8?q?setting=20:=20MSW=20=EB=B2=84=EC=A0=84=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95=202.6.9=20->=202.7.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
public/mockServiceWorker.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index fc3d48b..d837ffc 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
- "msw": "^2.6.9",
+ "msw": "^2.7.0",
"postcss": "^8.4.49",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.16",
diff --git a/public/mockServiceWorker.js b/public/mockServiceWorker.js
index 2c0b0fb..ec47a9a 100644
--- a/public/mockServiceWorker.js
+++ b/public/mockServiceWorker.js
@@ -8,7 +8,7 @@
* - Please do NOT serve this file on production.
*/
-const PACKAGE_VERSION = '2.6.9'
+const PACKAGE_VERSION = '2.7.0'
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()