From 4240cb89a42089d9028e3f9a2c5eacb17c699942 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 12:38:46 -0500 Subject: [PATCH 1/7] chore: Add codecov bundle analysis to docs repo --- next.config.js | 15 +++++++++++++ package.json | 1 + yarn.lock | 57 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 63 insertions(+), 10 deletions(-) diff --git a/next.config.js b/next.config.js index e992ce0a9aefb..f4e4977014562 100644 --- a/next.config.js +++ b/next.config.js @@ -20,6 +20,21 @@ const nextConfig = { serverComponentsExternalPackages: ['rehype-preset-minify'], }, + webpack: (config, _options) => { + config.plugins.push( + codecovWebpackPlugin({ + enableBundleAnalysis: + process.env.GITHUB_ACTIONS === 'true' && + typeof process.env.CODECOV_TOKEN === 'string' && + process.env.CODECOV_TOKEN.length > 0, + bundleName: 'sentry-docs', + uploadToken: process.env.CODECOV_TOKEN, + }) + ); + + return config; + }, + redirects() { return [ { diff --git a/package.json b/package.json index 08cad564e825d..636931538c3df 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.15.0", + "@codecov/webpack-plugin": "^0.0.1-beta.0", "@spotlightjs/spotlight": "^1.2.10", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.10", diff --git a/yarn.lock b/yarn.lock index e41d53d353463..220c608ebe63f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -520,6 +520,23 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@codecov/bundler-plugin-core@^0.0.1-beta.0": + version "0.0.1-beta.0" + resolved "https://registry.yarnpkg.com/@codecov/bundler-plugin-core/-/bundler-plugin-core-0.0.1-beta.0.tgz#b8c2bd4513c6d5ea5b2f1ca241b58b0d48a9453f" + integrity sha512-b3b2fZs9r9COefZEZYzGbLf0gab4HWKudwr6pkyUzXJEq061gIgQomeMxsBSRGVWkXtY6k9zzMDzkcVtj7A6GA== + dependencies: + chalk "4.1.2" + semver "^7.5.4" + unplugin "^1.6.0" + zod "^3.22.4" + +"@codecov/webpack-plugin@^0.0.1-beta.0": + version "0.0.1-beta.0" + resolved "https://registry.yarnpkg.com/@codecov/webpack-plugin/-/webpack-plugin-0.0.1-beta.0.tgz#2d542fd77b3f952544337f22493ae6e823cfca88" + integrity sha512-1+DQdYg2VfbkuVKE98jAWHfTfCXhnW17fmQ8d0O7bSRP1wgYo9kFRzRzIALA522KSTJPRf1icSDTdSRyTQmgRQ== + dependencies: + "@codecov/bundler-plugin-core" "^0.0.1-beta.0" + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -2786,7 +2803,7 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.0.0, acorn@^8.1.0, acorn@^8.2.4, acorn@^8.4.1, acorn@^8.8.1, acorn@^8.9.0: +acorn@^8.0.0, acorn@^8.1.0, acorn@^8.11.3, acorn@^8.2.4, acorn@^8.4.1, acorn@^8.8.1, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== @@ -3311,6 +3328,14 @@ chalk@3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -3320,14 +3345,6 @@ chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -9964,6 +9981,16 @@ universalify@^0.2.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== +unplugin@^1.6.0: + version "1.7.1" + resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.7.1.tgz#009571e3128640f4e327f33680d2db27afaf1e11" + integrity sha512-JqzORDAPxxs8ErLV4x+LL7bk5pk3YlcWqpSNsIkAZj972KzFZLClc/ekppahKkOczGkwIG6ElFgdOgOlK4tXZw== + dependencies: + acorn "^8.11.3" + chokidar "^3.5.3" + webpack-sources "^3.2.3" + webpack-virtual-modules "^0.6.1" + update-browserslist-db@^1.0.13: version "1.0.13" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" @@ -10178,11 +10205,16 @@ webidl-conversions@^7.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -"webpack-sources@^2.0.0 || ^3.0.0": +"webpack-sources@^2.0.0 || ^3.0.0", webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== +webpack-virtual-modules@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.6.1.tgz#ac6fdb9c5adb8caecd82ec241c9631b7a3681b6f" + integrity sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg== + whatwg-encoding@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" @@ -10398,6 +10430,11 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== +zod@^3.22.4: + version "3.22.4" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" + integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== + zwitch@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7" From c2804d01e668c8a2215ed0dbe5d56c97283aeb22 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 12:42:20 -0500 Subject: [PATCH 2/7] import codecov plugin --- next.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/next.config.js b/next.config.js index f4e4977014562..8ebff7e3ff302 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,6 @@ const createMDX = require('@next/mdx'); const remarkPrism = require('remark-prism'); +const {codecovWebpackPlugin} = require('@codecov/webpack-plugin'); /** @type {import('next').NextConfig} */ const nextConfig = { From ba2cbca5ad3059c93a79a3a7f1706340f1ed4f56 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 12:46:52 -0500 Subject: [PATCH 3/7] fix vercel condition --- next.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index 8ebff7e3ff302..ee6913feeaf45 100644 --- a/next.config.js +++ b/next.config.js @@ -25,9 +25,7 @@ const nextConfig = { config.plugins.push( codecovWebpackPlugin({ enableBundleAnalysis: - process.env.GITHUB_ACTIONS === 'true' && - typeof process.env.CODECOV_TOKEN === 'string' && - process.env.CODECOV_TOKEN.length > 0, + process.env.VERCEL_ENV === 'production' || process.env.VERCEL_ENV === 'preview', bundleName: 'sentry-docs', uploadToken: process.env.CODECOV_TOKEN, }) From 505abc9a1b948dceabe3773f7f86c9ab50596848 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 13:13:36 -0500 Subject: [PATCH 4/7] empty commit From 4ac37e460ed6ecf94fb7adfb27f6701d08c3d4f0 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 13:32:56 -0500 Subject: [PATCH 5/7] test if tokens are there --- next.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/next.config.js b/next.config.js index ee6913feeaf45..133dbacf0a266 100644 --- a/next.config.js +++ b/next.config.js @@ -22,6 +22,8 @@ const nextConfig = { }, webpack: (config, _options) => { + console.log(process.env.VERCEL_ENV); + console.log(typeof process.env.CODECOV_TOKEN, process.env.CODECOV_TOKEN?.length); config.plugins.push( codecovWebpackPlugin({ enableBundleAnalysis: From b994f5a2d632bcd411c095fc6b361aa0fe5a9914 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 13:36:25 -0500 Subject: [PATCH 6/7] fix condition --- next.config.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/next.config.js b/next.config.js index 133dbacf0a266..9c0a62b0ba8a3 100644 --- a/next.config.js +++ b/next.config.js @@ -22,12 +22,9 @@ const nextConfig = { }, webpack: (config, _options) => { - console.log(process.env.VERCEL_ENV); - console.log(typeof process.env.CODECOV_TOKEN, process.env.CODECOV_TOKEN?.length); config.plugins.push( codecovWebpackPlugin({ - enableBundleAnalysis: - process.env.VERCEL_ENV === 'production' || process.env.VERCEL_ENV === 'preview', + enableBundleAnalysis: typeof process.env.CODECOV_TOKEN === 'string', bundleName: 'sentry-docs', uploadToken: process.env.CODECOV_TOKEN, }) From b4925b902508c1d4629636d57ec311b3b2f64d07 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 22 Feb 2024 15:25:01 -0500 Subject: [PATCH 7/7] bump codecov --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 636931538c3df..6e5a7050543a9 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.15.0", - "@codecov/webpack-plugin": "^0.0.1-beta.0", + "@codecov/webpack-plugin": "^0.0.1-beta.1", "@spotlightjs/spotlight": "^1.2.10", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.10", diff --git a/yarn.lock b/yarn.lock index 220c608ebe63f..ed3ceae2ec326 100644 --- a/yarn.lock +++ b/yarn.lock @@ -520,22 +520,22 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@codecov/bundler-plugin-core@^0.0.1-beta.0": - version "0.0.1-beta.0" - resolved "https://registry.yarnpkg.com/@codecov/bundler-plugin-core/-/bundler-plugin-core-0.0.1-beta.0.tgz#b8c2bd4513c6d5ea5b2f1ca241b58b0d48a9453f" - integrity sha512-b3b2fZs9r9COefZEZYzGbLf0gab4HWKudwr6pkyUzXJEq061gIgQomeMxsBSRGVWkXtY6k9zzMDzkcVtj7A6GA== +"@codecov/bundler-plugin-core@^0.0.1-beta.1": + version "0.0.1-beta.1" + resolved "https://registry.yarnpkg.com/@codecov/bundler-plugin-core/-/bundler-plugin-core-0.0.1-beta.1.tgz#d84d83e59ff1670b350ed6cf97900643c567daef" + integrity sha512-58u6JPrfd7uUKH4mBpczJgbzd6Bws6NvmA9rSCLZXMwd9YWnFSqF8h/ZLJKN4Hp7y8lArl81P8BZUsoQMoO6Wg== dependencies: chalk "4.1.2" semver "^7.5.4" unplugin "^1.6.0" zod "^3.22.4" -"@codecov/webpack-plugin@^0.0.1-beta.0": - version "0.0.1-beta.0" - resolved "https://registry.yarnpkg.com/@codecov/webpack-plugin/-/webpack-plugin-0.0.1-beta.0.tgz#2d542fd77b3f952544337f22493ae6e823cfca88" - integrity sha512-1+DQdYg2VfbkuVKE98jAWHfTfCXhnW17fmQ8d0O7bSRP1wgYo9kFRzRzIALA522KSTJPRf1icSDTdSRyTQmgRQ== +"@codecov/webpack-plugin@^0.0.1-beta.1": + version "0.0.1-beta.1" + resolved "https://registry.yarnpkg.com/@codecov/webpack-plugin/-/webpack-plugin-0.0.1-beta.1.tgz#d0be931f6c4425279c817eb6243c12a3ba83aa49" + integrity sha512-Llzh1kWNN3hAMFjy30imMiIXeF4XWABtuOP7/2rtYcHL3AdWY9iiuGysoXttLjVwpqczjsUm1HgN2vJy/zuwGg== dependencies: - "@codecov/bundler-plugin-core" "^0.0.1-beta.0" + "@codecov/bundler-plugin-core" "^0.0.1-beta.1" "@cspotcode/source-map-support@^0.8.0": version "0.8.1"