From de1634a4a936649be7b60385085db9eadf493830 Mon Sep 17 00:00:00 2001 From: Greg Richardson Date: Thu, 4 May 2023 17:53:39 -0600 Subject: [PATCH] chore(docs): bundle analyzer --- apps/docs/next.config.mjs | 19 +++++++++++++++---- apps/docs/package.json | 2 ++ package-lock.json | 16 +++++++++------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index b3c71cae82e..029a3767707 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -6,6 +6,12 @@ import rehypeSlug from 'rehype-slug' import withTM from 'next-transpile-modules' import withYaml from 'next-plugin-yaml' +import configureBundleAnalyzer from '@next/bundle-analyzer' + +const withBundleAnalyzer = configureBundleAnalyzer({ + enabled: process.env.ANALYZE === 'true', +}) + // import admonitions from 'remark-admonitions' // import { remarkCodeHike } from '@code-hike/mdx' @@ -92,9 +98,14 @@ const nextConfig = { }, } -// next.config.js -export default () => { - // const plugins = [withMDX]/ - const plugins = [withTM(['ui', 'common', '@supabase/auth-helpers-nextjs']), withMDX, withYaml] +const configExport = () => { + const plugins = [ + withTM(['ui', 'common', '@supabase/auth-helpers-nextjs']), + withMDX, + withYaml, + withBundleAnalyzer, + ] return plugins.reduce((acc, next) => next(acc), nextConfig) } + +export default configExport diff --git a/apps/docs/package.json b/apps/docs/package.json index 0eb29301d62..a4d4a7133da 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -6,6 +6,7 @@ "dev": "next dev --port 3001", "dev:secrets:pull": "AWS_PROFILE=supabase-dev node internals/getSecrets.js", "build": "npm run generate:all && next build", + "build:analyze": "ANALYZE=true next build", "start": "next start", "lint": "next lint", "build:sitemap": "node ./internals/generate-sitemap.mjs", @@ -46,6 +47,7 @@ "@docsearch/react": "^3.3.0", "@mdx-js/loader": "^1.6.22", "@mdx-js/react": "^1.6.22", + "@next/bundle-analyzer": "^13.4.0", "@next/mdx": "^12.0.4", "@octokit/auth-app": "^4.0.9", "@octokit/core": "^4.2.0", diff --git a/package-lock.json b/package-lock.json index 0881d78353b..6237c010baa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "@docsearch/react": "^3.3.0", "@mdx-js/loader": "^1.6.22", "@mdx-js/react": "^1.6.22", + "@next/bundle-analyzer": "^13.4.0", "@next/mdx": "^12.0.4", "@octokit/auth-app": "^4.0.9", "@octokit/core": "^4.2.0", @@ -5267,9 +5268,9 @@ } }, "node_modules/@next/bundle-analyzer": { - "version": "13.2.4", - "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.2.4.tgz", - "integrity": "sha512-bY4Clt7f1roJextpeQOQQWfNiXI0O5UvfOEyfuM5YUGPQMOCAZD2zjLjolakdn9Dm2yyMQUQ6JDE+iJK0dIeLA==", + "version": "13.4.0", + "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.4.0.tgz", + "integrity": "sha512-3ni7Ple1By7RNk2MB/y4CC4aFJuyI2mYSRxDo8n5VckVJeLVasmmmvzdN45dKzgs8AHu3dPWIsS3+2NJKMyU+A==", "dependencies": { "webpack-bundle-analyzer": "4.7.0" } @@ -43187,9 +43188,9 @@ "integrity": "sha512-3fkKj25kEjsfObL6IlKPAlHYPq/oYwUkkQ03zsTTiDjD7vg/RxjdiLeCydqtxHZP0JgsXL3D/X5oAkMGzuUp/Q==" }, "@next/bundle-analyzer": { - "version": "13.2.4", - "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.2.4.tgz", - "integrity": "sha512-bY4Clt7f1roJextpeQOQQWfNiXI0O5UvfOEyfuM5YUGPQMOCAZD2zjLjolakdn9Dm2yyMQUQ6JDE+iJK0dIeLA==", + "version": "13.4.0", + "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.4.0.tgz", + "integrity": "sha512-3ni7Ple1By7RNk2MB/y4CC4aFJuyI2mYSRxDo8n5VckVJeLVasmmmvzdN45dKzgs8AHu3dPWIsS3+2NJKMyU+A==", "requires": { "webpack-bundle-analyzer": "4.7.0" } @@ -51526,6 +51527,7 @@ "@docsearch/react": "^3.3.0", "@mdx-js/loader": "^1.6.22", "@mdx-js/react": "^1.6.22", + "@next/bundle-analyzer": "^13.4.0", "@next/mdx": "^12.0.4", "@octokit/auth-app": "^4.0.9", "@octokit/core": "^4.2.0", @@ -68107,7 +68109,7 @@ "@types/react": "^17.0.37", "@types/react-copy-to-clipboard": "^5.0.4", "@types/react-dom": "^17.0.11", - "@types/react-syntax-highlighter": "*", + "@types/react-syntax-highlighter": "^15.5.6", "autoprefixer": "^10.4.2", "clsx": "^1.2.1", "cmdk-supabase": "^0.2.2",