From 8ea8fddae7807c1dd4325821a538d15edf8336d0 Mon Sep 17 00:00:00 2001 From: JunSeok Date: Tue, 26 Nov 2024 11:27:23 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20setupMocks=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/main.tsx | 21 ++++++++++++++++++++- src/shared/test/setupMocks.ts | 17 ----------------- 2 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 src/shared/test/setupMocks.ts diff --git a/src/app/main.tsx b/src/app/main.tsx index 1c42d987..950ffe01 100644 --- a/src/app/main.tsx +++ b/src/app/main.tsx @@ -10,11 +10,30 @@ import { store } from './store'; export const serverAPI = (path: string) => `${import.meta.env.VITE_API_URL}${path}`; +async function setupMocks(): Promise { + if (import.meta.env.MODE !== 'development') { + return; + } + + if (import.meta.env.VITE_USE_MOCK !== 'true') return; + + const { worker } = await import('../shared/test/browser'); + await worker.start({ + onUnhandledRequest: (req) => { + const url = new URL(req.url); + if (url.pathname.endsWith('.svg')) { + return; // .svg 파일 요청을 무시 + } + }, + }); +} + + (async () => { const token = localStorage.getItem('accessToken'); if (token) store.dispatch(storeLogin({ token })) - await import('../shared/test/setupMocks').then((module) => module.setupMocks()) + await setupMocks() ReactDOM.createRoot(document.getElementById('root')!).render( diff --git a/src/shared/test/setupMocks.ts b/src/shared/test/setupMocks.ts deleted file mode 100644 index c14d4210..00000000 --- a/src/shared/test/setupMocks.ts +++ /dev/null @@ -1,17 +0,0 @@ -export async function setupMocks(): Promise { - if (import.meta.env.MODE !== 'development') { - return; - } - - if (import.meta.env.VITE_USE_MOCK !== 'true') return; - - const { worker } = await import('../test/browser'); - await worker.start({ - onUnhandledRequest: (req) => { - const url = new URL(req.url); - if (url.pathname.endsWith('.svg')) { - return; // .svg 파일 요청을 무시 - } - }, - }); -} From 46c01c8e670cb33493541e0f16cee67a494ab154 Mon Sep 17 00:00:00 2001 From: JunSeok Date: Tue, 26 Nov 2024 11:27:49 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EB=B0=B0=ED=8F=AC=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=20=ED=8C=8C=EC=9D=BC=20=EC=BA=90=EC=8B=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=8F=20s3=20=EB=8F=99=EA=B8=B0=ED=99=94=20?= =?UTF-8?q?=EC=98=B5=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 405e27c2..11f4af93 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,11 +26,16 @@ jobs: - name: Install dependencies run: npm ci - # 4. 빌드 실행 + # 4. 기존 빌드 파일 삭제 + - name: Clean build directory + run: | + rm -rf dist + + # 5. 빌드 실행 - name: Build project run: npm run build - # 5. AWS 크레덴셜 설정 + # 6. AWS 크레덴셜 설정 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v3 with: @@ -38,13 +43,13 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.AWS_REGION }} - # 6. S3로 배포 + # 7. S3로 배포 - name: Deploy to S3 run: | - aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }} --delete + aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }} --delete --exact-timestamps echo "Deployment to S3 and CloudFront completed successfully!" - # 7. CloudFront 캐시 무효화 + # 8. CloudFront 캐시 무효화 - name: Invalidate CloudFront Cache run: | aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"