Skip to content

Commit 808a862

Browse files
ci(codecov): add bundle analysis (#3843)
1 parent a70cf5e commit 808a862

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ jobs:
952952
env:
953953
BRANCH: ${{ github.head_ref || github.ref_name }}
954954
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
955+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
955956
COMMIT: ${{ needs.setup_release.outputs.release_commit }}
956957
run: |
957958
mkdir -p build

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"vue-i18n": "11.1.3"
1414
},
1515
"devDependencies": {
16+
"@codecov/vite-plugin": "1.9.0",
1617
"@vitejs/plugin-vue": "4.6.2",
1718
"serve": "14.2.3",
1819
"vite": "4.5.9",

vite.config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import fs from 'fs';
33
import { resolve } from 'path'
44
import { defineConfig } from 'vite'
55
import { ViteEjsPlugin } from "vite-plugin-ejs";
6+
import { codecovVitePlugin } from "@codecov/vite-plugin";
67
import vue from '@vitejs/plugin-vue'
78
import process from 'process'
89

910
/**
1011
* Before actually building the pages with Vite, we do an intermediate build step using ejs
11-
* Importing this separately and joining them using ejs
12-
* allows us to split some repeating HTML that cannot be added
12+
* Importing this separately and joining them using ejs
13+
* allows us to split some repeating HTML that cannot be added
1314
* by Vue itself (e.g. style/script loading, common meta head tags, Widgetbot)
1415
* The vite-plugin-ejs handles this automatically
1516
*/
@@ -49,7 +50,16 @@ export default defineConfig({
4950
}
5051
},
5152
base: './',
52-
plugins: [vue(), ViteEjsPlugin({ header })],
53+
plugins: [
54+
vue(),
55+
ViteEjsPlugin({ header }),
56+
// The Codecov vite plugin should be after all other plugins
57+
codecovVitePlugin({
58+
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
59+
bundleName: "sunshine",
60+
uploadToken: process.env.CODECOV_TOKEN,
61+
}),
62+
],
5363
root: resolve(assetsSrcPath),
5464
build: {
5565
outDir: resolve(assetsDstPath),

0 commit comments

Comments
 (0)