From 4ea30ced6d7dab8d08866bfbc17acb93e5e84f7c Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 13 Aug 2024 10:38:19 -0400 Subject: [PATCH 1/6] adding codecov webpack plugin for bundle analysis --- next.config.mjs | 8 +++++ package-lock.json | 74 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 83 insertions(+) diff --git a/next.config.mjs b/next.config.mjs index a86a7d6..026abd1 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,5 @@ import { withSentryConfig } from "@sentry/nextjs"; +import { codecovWebpackPlugin } from "@codecov/webpack-plugin"; import webpack from "webpack"; /** @type {import('next').NextConfig} */ @@ -16,6 +17,13 @@ const nextConfig = { }), ); } + config.plugins.push( + codecovWebpackPlugin({ + enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, + bundleName: "nextjs-clean-architecture", + uploadToken: process.env.CODECOV_TOKEN, + }), + ); return config; }, }; diff --git a/package-lock.json b/package-lock.json index c21f56c..fdecf8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "zod": "^3.23.8" }, "devDependencies": { + "@codecov/webpack-plugin": "^0.0.1-beta.10", "@types/better-sqlite3": "^7.6.11", "@types/node": "^20", "@types/react": "^18", @@ -407,6 +408,79 @@ "node": ">=6.9.0" } }, + "node_modules/@codecov/bundler-plugin-core": { + "version": "0.0.1-beta.10", + "resolved": "https://registry.npmjs.org/@codecov/bundler-plugin-core/-/bundler-plugin-core-0.0.1-beta.10.tgz", + "integrity": "sha512-fOgy02gc0Z0ipKVe8QqN7mcmzQYjHb2UzT6RtHR+tqyYwpe1r1Kg5E/pbIOXKLaJGXK+AaOX23qtgp6kvUn+iA==", + "dev": true, + "dependencies": { + "chalk": "4.1.2", + "semver": "^7.5.4", + "unplugin": "^1.10.1", + "zod": "^3.22.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@codecov/bundler-plugin-core/node_modules/unplugin": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.12.1.tgz", + "integrity": "sha512-aXEH9c5qi3uYZHo0niUtxDlT9ylG/luMW/dZslSCkbtC31wCyFkmM0kyoBBh+Grhn7CL+/kvKLfN61/EdxPxMQ==", + "dev": true, + "dependencies": { + "acorn": "^8.12.1", + "chokidar": "^3.6.0", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@codecov/bundler-plugin-core/node_modules/webpack-virtual-modules": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz", + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==", + "dev": true + }, + "node_modules/@codecov/webpack-plugin": { + "version": "0.0.1-beta.10", + "resolved": "https://registry.npmjs.org/@codecov/webpack-plugin/-/webpack-plugin-0.0.1-beta.10.tgz", + "integrity": "sha512-wGh4YEy05HdNa64zRbqv20t7gq24mqTf0T3YUr6XzEd7DLHvm3QcTtUOz8Q8eekMKtvS0CiH3UHmBIAQyPSTZw==", + "dev": true, + "dependencies": { + "@codecov/bundler-plugin-core": "^0.0.1-beta.10", + "unplugin": "^1.10.1" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "webpack": "5.x" + } + }, + "node_modules/@codecov/webpack-plugin/node_modules/unplugin": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.12.1.tgz", + "integrity": "sha512-aXEH9c5qi3uYZHo0niUtxDlT9ylG/luMW/dZslSCkbtC31wCyFkmM0kyoBBh+Grhn7CL+/kvKLfN61/EdxPxMQ==", + "dev": true, + "dependencies": { + "acorn": "^8.12.1", + "chokidar": "^3.6.0", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@codecov/webpack-plugin/node_modules/webpack-virtual-modules": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz", + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==", + "dev": true + }, "node_modules/@drizzle-team/brocli": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/@drizzle-team/brocli/-/brocli-0.8.2.tgz", diff --git a/package.json b/package.json index aef5365..f68d32c 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "zod": "^3.23.8" }, "devDependencies": { + "@codecov/webpack-plugin": "^0.0.1-beta.10", "@types/better-sqlite3": "^7.6.11", "@types/node": "^20", "@types/react": "^18", From 4ec5af74d1a4064d8448ae4fb3a10b76e05ee1c8 Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 13 Aug 2024 10:40:10 -0400 Subject: [PATCH 2/6] add build step in workflow --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7de3fd..36e0d0c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,8 @@ jobs: cache: "npm" - name: Install dependencies run: npm install + - name: Build app + run: npm run build - name: Run tests with coverage run: npm run coverage - name: Upload coverage to Codecov From c105e064cc60ce86cc15998dee850cd8a5f11e44 Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 13 Aug 2024 10:45:52 -0400 Subject: [PATCH 3/6] adding codecov token env to build step --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 36e0d0c..c44650c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,8 @@ jobs: run: npm install - name: Build app run: npm run build + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Run tests with coverage run: npm run coverage - name: Upload coverage to Codecov From 5d569c905269b56457d849507f502c755d9d7dec Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 13 Aug 2024 10:49:26 -0400 Subject: [PATCH 4/6] adding sentry auth token to build step --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c44650c..46f0d91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ jobs: run: npm run build env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Run tests with coverage run: npm run coverage - name: Upload coverage to Codecov From f4c3745f143522f34d3a96bdb48a60cdb2237f12 Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 13 Aug 2024 11:15:03 -0400 Subject: [PATCH 5/6] set codecov require_bundle_changes to false --- codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov.yml b/codecov.yml index bfc8941..62f30d9 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,6 +2,7 @@ comment: layout: "diff, flags, files" behavior: default require_changes: false + require_bundle_changes: false require_base: false require_head: true hide_project_coverage: false From 2fe9352a006a30d604cf9214f1ecaf1312e2fa7e Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 13 Aug 2024 11:27:41 -0400 Subject: [PATCH 6/6] for some reason my last commit didn't go through, so I'm triggering this change --- codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov.yml b/codecov.yml index 62f30d9..1b6cce4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -6,6 +6,7 @@ comment: require_base: false require_head: true hide_project_coverage: false + ignore: - "app" - "di"