From 4ca4a784b27e566badd8986594bb542d23ce8470 Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Fri, 11 Oct 2024 20:42:28 -0400 Subject: [PATCH] fix nextjs --- .../workflows/deploy-docs-bundle-preview.yml | 20 +++++++++++++++++++ packages/ui/docs-bundle/next.config.mjs | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs-bundle-preview.yml b/.github/workflows/deploy-docs-bundle-preview.yml index 28795abf4c..6d113a6701 100644 --- a/.github/workflows/deploy-docs-bundle-preview.yml +++ b/.github/workflows/deploy-docs-bundle-preview.yml @@ -63,6 +63,26 @@ jobs: filePath: preview.txt comment_tag: pr_preview + analyze: + needs: ignore + if: needs.ignore.outputs.continue == 1 + runs-on: ubuntu-latest + permissions: write-all # required for the pr-preview comment + steps: + # set the ref to a specific branch so that the deployment is scoped to that branch (instead of a headless ref) + - uses: actions/checkout@v4 + with: + fetch-depth: 2 # used for turbo-ignore + ref: ${{ github.event.pull_request.head.ref || github.ref_name || github.ref }} + + - uses: ./.github/actions/install + + - name: Build + id: deploy + run: pnpm vercel-scripts deploy app.buildwithfern.com --token=${{ secrets.VERCEL_TOKEN }} --skip-deploy=true + env: + ANALYZE: 1 + - name: Analyze bundle if: steps.deploy.outputs.deployment_url run: pnpm --package=nextjs-bundle-analysis dlx report diff --git a/packages/ui/docs-bundle/next.config.mjs b/packages/ui/docs-bundle/next.config.mjs index ddee42d6f8..78d352f9c2 100644 --- a/packages/ui/docs-bundle/next.config.mjs +++ b/packages/ui/docs-bundle/next.config.mjs @@ -164,7 +164,7 @@ export default (phase) => { } const withBundleAnalyzer = NextBundleAnalyzer({ - enabled: true, + enabled: process.env.ANALYZE === "1", }); return withBundleAnalyzer(withVercelEnv(nextConfig));