Skip to content

Commit 49043ee

Browse files
committed
Fix: Resolve asset 404 errors and LinkedIn CORS issues
1 parent 7e7208c commit 49043ee

28 files changed

Lines changed: 4157 additions & 94 deletions

.env.example

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
1-
# Environment Variables Template
2-
# Copy this file to .env and fill in your actual values
1+
# Environment Variables Example
2+
# Copy this file to .env and fill in your values
33

4-
# Gemini AI API Key - Empty by default
4+
# Gemini API Key (for AI Chatbot)
5+
# Get your key from: https://makersuite.google.com/app/apikey
56
GEMINI_API_KEY=
67

7-
# Development settings
8-
# NODE_ENV is automatically set by Vite - do not set it manually
8+
# Google Analytics 4 Measurement ID
9+
# Get your ID from: https://analytics.google.com
10+
# Format: G-XXXXXXXXXX
11+
VITE_GA_MEASUREMENT_ID=
912

10-
# Environment-specific visibility controls
11-
VITE_SHOW_DEV_ELEMENTS=true
12-
VITE_SHOW_VISITOR_CONTROLS=true
13-
VITE_SHOW_PROFILE_INSIGHTS=true
14-
VITE_SHOW_TRANSLATION_DEBUG=true
15-
VITE_SHOW_DEBUG_INFO=true
16-
17-
# Chatbot Configuration - Disabled by default
18-
VITE_ENABLE_CHATBOT=false
19-
20-
# Recommended Sections Configuration - Enabled by default
21-
# Set to 'false' to disable the "Recommended for you" section in home
22-
VITE_SHOW_RECOMMENDED_SECTIONS=true
23-
24-
# Vite Environment Variables (accessible in browser)
25-
VITE_APP_TITLE=Khalil Charfi Portfolio
26-
27-
# Personas Configuration
28-
# Set to 'false' to completely disable personas feature
13+
# Feature Flags
14+
VITE_ENABLE_CHATBOT=true
15+
VITE_ENABLE_DYNAMIC_CONTENT=true
2916
VITE_ENABLE_PERSONAS=true
30-
31-
# Personas Management (comma-separated lists)
32-
# VITE_ENABLED_PERSONAS=general_visitor,recruiter,developer
33-
# VITE_DISABLED_PERSONAS=recruiter
34-
35-
# Content Mode Configuration - Disabled by default
36-
# Set to 'false' to disable dynamic content and use static default content
37-
VITE_ENABLE_DYNAMIC_CONTENT=false
38-
39-
# Set to 'true' to force default content mode (overrides dynamic content)
4017
VITE_FORCE_DEFAULT_CONTENT=false
18+
VITE_SHOW_RECOMMENDED_SECTIONS=true
19+
20+
# Development/Debug Flags (set to false in production)
21+
VITE_SHOW_DEV_ELEMENTS=false
22+
VITE_SHOW_VISITOR_CONTROLS=false
23+
VITE_SHOW_PROFILE_INSIGHTS=false
24+
VITE_SHOW_TRANSLATION_DEBUG=false
25+
VITE_SHOW_DEBUG_INFO=false
4126

42-
# Optional: Add other environment variables as needed
43-
# VITE_API_BASE_URL=http://localhost:3000
44-
# VITE_ANALYTICS_ID=your_analytics_id
27+
# Environment
28+
NODE_ENV=development

.github/workflows/bundle-size.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Bundle Size Check
2+
3+
on:
4+
pull_request:
5+
branches: [main, next, develop]
6+
push:
7+
branches: [main, next, develop]
8+
9+
jobs:
10+
check-bundle-size:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # Full history for comparison
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build current version
29+
run: npm run build
30+
31+
- name: Get current bundle size
32+
id: current-size
33+
run: |
34+
# Get total gzipped size
35+
TOTAL_SIZE=$(find dist -name '*.js' -o -name '*.css' | xargs gzip -c | wc -c)
36+
TOTAL_SIZE_KB=$((TOTAL_SIZE / 1024))
37+
38+
# Get individual chunk sizes
39+
echo "📦 Current Bundle Sizes:"
40+
echo ""
41+
echo "| File | Size (gzipped) |"
42+
echo "|------|----------------|"
43+
44+
find dist/assets -name '*.js' -type f | while read file; do
45+
FILENAME=$(basename "$file")
46+
GZIP_SIZE=$(gzip -c "$file" | wc -c)
47+
GZIP_SIZE_KB=$((GZIP_SIZE / 1024))
48+
echo "| $FILENAME | ${GZIP_SIZE_KB} KB |"
49+
done
50+
51+
echo ""
52+
echo "**Total Bundle Size: ${TOTAL_SIZE_KB} KB (gzipped)**"
53+
echo ""
54+
55+
# Save for comparison
56+
echo "size=$TOTAL_SIZE_KB" >> $GITHUB_OUTPUT
57+
echo "${TOTAL_SIZE_KB}" > current-size.txt
58+
59+
- name: Check against target
60+
run: |
61+
CURRENT_SIZE=${{ steps.current-size.outputs.size }}
62+
TARGET_SIZE=350
63+
STRETCH_TARGET=300
64+
65+
echo "### 🎯 Bundle Size Report"
66+
echo ""
67+
echo "- **Current:** ${CURRENT_SIZE} KB"
68+
echo "- **Target:** ${TARGET_SIZE} KB"
69+
echo "- **Stretch Goal:** ${STRETCH_TARGET} KB"
70+
echo ""
71+
72+
if [ $CURRENT_SIZE -le $STRETCH_TARGET ]; then
73+
echo "✅ **Excellent!** Bundle is under stretch goal!"
74+
echo "🏆 Savings: $((TARGET_SIZE - CURRENT_SIZE)) KB under target"
75+
elif [ $CURRENT_SIZE -le $TARGET_SIZE ]; then
76+
echo "✅ **Good!** Bundle meets target size!"
77+
echo "📊 Savings: $((TARGET_SIZE - CURRENT_SIZE)) KB under target"
78+
else
79+
echo "⚠️ **Warning:** Bundle exceeds target!"
80+
echo "📈 Over by: $((CURRENT_SIZE - TARGET_SIZE)) KB"
81+
82+
# Don't fail the build, just warn
83+
if [ $CURRENT_SIZE -gt 450 ]; then
84+
echo "❌ **Error:** Bundle is critically large (>450 KB)!"
85+
exit 1
86+
fi
87+
fi
88+
89+
- name: Compare with base branch (PR only)
90+
if: github.event_name == 'pull_request'
91+
run: |
92+
# Checkout base branch
93+
git fetch origin ${{ github.base_ref }}
94+
git checkout origin/${{ github.base_ref }}
95+
96+
# Install and build base
97+
npm ci --prefer-offline
98+
npm run build
99+
100+
# Get base size
101+
BASE_SIZE=$(find dist -name '*.js' -o -name '*.css' | xargs gzip -c | wc -c)
102+
BASE_SIZE_KB=$((BASE_SIZE / 1024))
103+
104+
# Checkout PR branch again
105+
git checkout ${{ github.head_ref }}
106+
107+
# Compare
108+
CURRENT_SIZE=${{ steps.current-size.outputs.size }}
109+
DIFF=$((CURRENT_SIZE - BASE_SIZE_KB))
110+
111+
echo "### 📊 Bundle Size Comparison"
112+
echo ""
113+
echo "| Metric | Size |"
114+
echo "|--------|------|"
115+
echo "| Base (${{ github.base_ref }}) | ${BASE_SIZE_KB} KB |"
116+
echo "| Current (PR) | ${CURRENT_SIZE} KB |"
117+
echo "| **Difference** | **${DIFF} KB** |"
118+
echo ""
119+
120+
if [ $DIFF -lt 0 ]; then
121+
echo "✅ **Bundle size decreased by $((-DIFF)) KB!** 🎉"
122+
elif [ $DIFF -eq 0 ]; then
123+
echo "✅ **No change in bundle size**"
124+
else
125+
PERCENT=$(echo "scale=1; $DIFF * 100 / $BASE_SIZE_KB" | bc)
126+
echo "⚠️ **Bundle size increased by ${DIFF} KB (+${PERCENT}%)**"
127+
128+
if (( $(echo "$PERCENT > 5" | bc -l) )); then
129+
echo "❌ **Error:** Bundle size increased by more than 5%!"
130+
exit 1
131+
fi
132+
fi
133+
134+
- name: Upload bundle analysis
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: bundle-analysis
138+
path: |
139+
dist/bundle-analysis.html
140+
current-size.txt
141+
retention-days: 30
142+
143+
- name: Comment PR (if applicable)
144+
if: github.event_name == 'pull_request'
145+
uses: actions/github-script@v7
146+
with:
147+
script: |
148+
const fs = require('fs');
149+
const size = fs.readFileSync('current-size.txt', 'utf8').trim();
150+
151+
const comment = `### 📦 Bundle Size Report
152+
153+
**Current Size:** ${size} KB (gzipped)
154+
**Target:** 350 KB
155+
**Stretch Goal:** 300 KB
156+
157+
[View detailed bundle analysis](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
158+
`;
159+
160+
github.rest.issues.createComment({
161+
issue_number: context.issue.number,
162+
owner: context.repo.owner,
163+
repo: context.repo.repo,
164+
body: comment
165+
});
166+

0 commit comments

Comments
 (0)