From dfd6132e26af84f349abd88f4ce9aa2b09fea1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=9C=EB=A0=B9?= Date: Fri, 6 Oct 2023 15:31:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8A=A4=ED=86=A0=EB=A6=AC=EB=B6=81=20?= =?UTF-8?q?=EB=B0=B0=ED=8F=AC=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=EC=97=90=EC=84=9C=20=EC=BA=90=EC=8B=9C=20=EB=AC=B4?= =?UTF-8?q?=ED=9A=A8=ED=99=94=20=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=EB=B0=8F=20mockServiceWorker=20=EA=B2=BD=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#466)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore/#465: 클라우드프론트 캐시 무효화 로직 워크플로우에서 삭제 * chore/#465: 스토리북 mockServiceWorker 경로 설정 --- .github/workflows/frontend-storybook-deploy.yml | 5 ----- frontend/.storybook/preview.tsx | 13 ++++++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/frontend-storybook-deploy.yml b/.github/workflows/frontend-storybook-deploy.yml index 2ae6c5f24..ef09cab30 100644 --- a/.github/workflows/frontend-storybook-deploy.yml +++ b/.github/workflows/frontend-storybook-deploy.yml @@ -71,8 +71,3 @@ jobs: - name: Upload to S3 run: | aws s3 sync frontend/storybook s3://2023-team-project/2023-zipgo/storybook --delete - - name: Cloudfront invalidation - run: | - aws cloudfront create-invalidation \ - --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} \ - --paths "/storybook/*" diff --git a/frontend/.storybook/preview.tsx b/frontend/.storybook/preview.tsx index 0d85ce0af..97dbdb1e4 100644 --- a/frontend/.storybook/preview.tsx +++ b/frontend/.storybook/preview.tsx @@ -8,7 +8,18 @@ import { initialize, mswDecorator } from 'msw-storybook-addon'; import { withRouter } from 'storybook-addon-react-router-v6'; import handlers from '../src/mocks/handlers'; -initialize(); // msw-storybook-addon +let options = {}; + +if (location.hostname.includes('cloudfront')) { + options = { + serviceWorker: { + url: '/storybook/mockServiceWorker.js', + }, + }; +} + +// Initialize MSW +initialize(options); const queryClient = new QueryClient({ defaultOptions: {