From 9b3ddcf6415c30f66ea2d4b475a315ce82f45787 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:52:33 -0400 Subject: [PATCH] ci(coverage): add bundle analysis (#19) --- .github/workflows/ci.yml | 2 ++ package.json | 1 + webpack.config.js | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c88e8a..4bf17b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,8 @@ jobs: npm test - name: Build + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: npm run build - name: Upload test results to Codecov diff --git a/package.json b/package.json index 899a534..b5d98d3 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "devDependencies": { "@babel/core": "7.25.2", "@babel/preset-env": "7.25.4", + "@codecov/webpack-plugin": "0.0.1-beta.10", "@eslint/js": "9.9.1", "@jest/globals": "29.7.0", "babel-loader": "9.1.3", diff --git a/webpack.config.js b/webpack.config.js index 295c28b..32bfd50 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,5 @@ const path = require('path'); +const { codecovWebpackPlugin } = require("@codecov/webpack-plugin"); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); let production = process.env.NODE_ENV === 'production'; @@ -75,6 +76,12 @@ let config = { new MiniCssExtractPlugin({ filename: '[name].css', }), + // Put the Codecov webpack plugin after all other plugins + codecovWebpackPlugin({ + enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, + bundleName: "shared-web", + uploadToken: process.env.CODECOV_TOKEN, + }), ], resolve: { extensions: ['.js'],