File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Lighthouse CI
2+
3+ on :
4+ push :
5+ branches : [master, main]
6+ pull_request :
7+ branches : [master, main]
8+
9+ jobs :
10+ lighthouse :
11+ name : Lighthouse Performance Audit
12+ runs-on : ubuntu-latest
13+ if : github.server_url == 'https://github.com'
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - name : Setup pnpm
18+ uses : pnpm/action-setup@v4
19+ with :
20+ version : 9
21+
22+ - name : Setup Node.js
23+ uses : actions/setup-node@v4
24+ with :
25+ node-version : ' 20'
26+ cache : ' pnpm'
27+
28+ - name : Install dependencies
29+ run : pnpm install --frozen-lockfile
30+
31+ - name : Build project
32+ run : pnpm build
33+
34+ - name : Run Lighthouse CI
35+ uses : treosh/lighthouse-ci-action@v12
36+ with :
37+ urls : |
38+ http://localhost:3000
39+ http://localhost:3000/docs
40+ uploadArtifacts : true
41+ temporaryPublicStorage : true
42+ runs : 3
Original file line number Diff line number Diff line change 1+ // Alternative JS config for more flexibility
2+ module . exports = {
3+ ci : {
4+ collect : {
5+ startServerCommand : 'pnpm start' ,
6+ startServerReadyPattern : 'Ready' ,
7+ url : [ 'http://localhost:3000' , 'http://localhost:3000/docs' ] ,
8+ numberOfRuns : 3 ,
9+ } ,
10+ assert : {
11+ preset : 'lighthouse:recommended' ,
12+ assertions : {
13+ 'categories:performance' : [ 'error' , { minScore : 0.8 } ] ,
14+ 'categories:accessibility' : [ 'error' , { minScore : 0.9 } ] ,
15+ 'categories:best-practices' : [ 'error' , { minScore : 0.9 } ] ,
16+ 'categories:seo' : [ 'error' , { minScore : 0.9 } ] ,
17+ } ,
18+ } ,
19+ upload : {
20+ target : 'temporary-public-storage' ,
21+ } ,
22+ } ,
23+ }
Original file line number Diff line number Diff line change 1+ {
2+ "ci" : {
3+ "collect" : {
4+ "startServerCommand" : " pnpm start" ,
5+ "startServerReadyPattern" : " Ready" ,
6+ "url" : [
7+ " http://localhost:3000" ,
8+ " http://localhost:3000/docs"
9+ ],
10+ "numberOfRuns" : 3
11+ },
12+ "assert" : {
13+ "preset" : " lighthouse:recommended" ,
14+ "assertions" : {
15+ "categories:performance" : [" error" , { "minScore" : 0.8 }],
16+ "categories:accessibility" : [" error" , { "minScore" : 0.9 }],
17+ "categories:best-practices" : [" error" , { "minScore" : 0.9 }],
18+ "categories:seo" : [" error" , { "minScore" : 0.9 }]
19+ }
20+ },
21+ "upload" : {
22+ "target" : " temporary-public-storage"
23+ }
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -4,4 +4,9 @@ const nextConfig: NextConfig = {
44 /* config options here */
55}
66
7- export default nextConfig
7+ // Bundle analyzer configuration
8+ const withBundleAnalyzer = require ( '@next/bundle-analyzer' ) ( {
9+ enabled : process . env . ANALYZE === 'true' ,
10+ } )
11+
12+ export default withBundleAnalyzer ( nextConfig )
Original file line number Diff line number Diff line change 1010 "scripts" : {
1111 "dev" : " next dev --turbopack" ,
1212 "build" : " next build" ,
13+ "build:analyze" : " cross-env ANALYZE=true next build" ,
1314 "start" : " next start" ,
1415 "lint" : " next lint" ,
1516 "format" : " prettier --write ." ,
6061 "zod" : " ^3.25.76"
6162 },
6263 "devDependencies" : {
64+ "@next/bundle-analyzer" : " ^15.5.2" ,
6365 "@commitlint/cli" : " ^20.1.0" ,
6466 "@commitlint/config-conventional" : " ^20.0.0" ,
6567 "@eslint/eslintrc" : " ^3.3.1" ,
6668 "@tailwindcss/postcss" : " ^4.1.11" ,
6769 "@types/node" : " ^20.19.9" ,
6870 "@types/react" : " 19.1.2" ,
6971 "@types/react-dom" : " 19.1.2" ,
72+ "cross-env" : " ^7.0.3" ,
7073 "eslint" : " ^9.32.0" ,
7174 "eslint-config-next" : " 15.3.1" ,
7275 "husky" : " ^9.1.7" ,
You can’t perform that action at this time.
0 commit comments