Skip to content

Commit 07c8bb6

Browse files
committed
Merged with dev
2 parents 6f1bff1 + af3887e commit 07c8bb6

File tree

61 files changed

+886
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+886
-113
lines changed

.claude/commands/convert-images.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Convert Images to WebP Format
2+
3+
This command helps you batch convert PNG/JPG images to WebP format for better performance and update all references in the documentation.
4+
5+
## Prerequisites
6+
7+
Ensure `cwebp` is installed:
8+
```bash
9+
# macOS
10+
brew install webp
11+
12+
# Ubuntu/Debian
13+
sudo apt-get install webp
14+
15+
# Check installation
16+
cwebp -version
17+
```
18+
19+
## Steps to Complete
20+
21+
1. **Select Scope**
22+
- Ask user: Convert images for specific product or all products?
23+
- If specific product, ask which one (e.g., "accessanalyzer")
24+
25+
2. **Find Images to Convert**
26+
```bash
27+
# For specific product
28+
find /static/img/product_docs/{productname} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -print0
29+
30+
# For all products
31+
find /static/img/product_docs -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -print0
32+
```
33+
34+
3. **Create Backup**
35+
```bash
36+
# Create backup directory with timestamp
37+
backup_dir="/static/img/product_docs/.backup-$(date +%Y%m%d-%H%M%S)"
38+
mkdir -p "$backup_dir"
39+
40+
# Copy images to backup
41+
find /static/img/product_docs/{scope} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -exec cp {} "$backup_dir/" \;
42+
```
43+
44+
4. **Convert Images to WebP**
45+
```bash
46+
# Convert each image
47+
find /static/img/product_docs/{scope} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) | while read -r img; do
48+
# Get filename without extension
49+
filename="${img%.*}"
50+
51+
# Convert to WebP (quality 85 is usually good balance)
52+
cwebp -q 85 "$img" -o "${filename}.webp"
53+
54+
echo "Converted: $img -> ${filename}.webp"
55+
done
56+
```
57+
58+
5. **Update Markdown References**
59+
```bash
60+
# Find all markdown files that reference the images
61+
# For each converted image, update references
62+
63+
# Example for a specific image:
64+
old_image="image.png"
65+
new_image="image.webp"
66+
67+
# Find and replace in markdown files
68+
find /docs/{scope} -name "*.md" -type f -exec grep -l "$old_image" {} \; | while read -r file; do
69+
# Use sed to replace image references
70+
sed -i.bak "s|${old_image}|${new_image}|g" "$file"
71+
done
72+
```
73+
74+
6. **Verify Updates**
75+
- Check that all references were updated
76+
- Preview a few pages to ensure images display correctly
77+
- Compare file sizes to show savings
78+
79+
7. **Clean Up Old Images**
80+
After verification, ask user to confirm deletion:
81+
```bash
82+
# Show size comparison
83+
echo "Original images size:"
84+
du -sh /static/img/product_docs/.backup-*/
85+
86+
echo "WebP images size:"
87+
find /static/img/product_docs/{scope} -name "*.webp" -exec du -ch {} + | grep total
88+
89+
# If confirmed, remove original images
90+
find /static/img/product_docs/{scope} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -delete
91+
```
92+
93+
8. **Test Documentation**
94+
```bash
95+
# Start development server to verify images load
96+
npm start {productname}
97+
```
98+
99+
## Quality Settings
100+
101+
- **85**: Good balance of quality and size (default)
102+
- **90**: Higher quality for detailed screenshots
103+
- **80**: Smaller size for simple diagrams
104+
- **95**: Near-lossless for critical images
105+
106+
## Example Output
107+
108+
```
109+
Converting images for accessanalyzer...
110+
✓ Created backup at /static/img/product_docs/.backup-20240119-143022/
111+
✓ Converted 45 images to WebP format
112+
✓ Updated 127 markdown files
113+
✓ Size reduction: 12.3MB → 4.7MB (62% smaller)
114+
✓ All images verified in documentation
115+
116+
Delete original images? (y/n)
117+
```
118+
119+
## Important Notes
120+
121+
- Always create a backup before converting
122+
- Test image quality before deleting originals
123+
- WebP is supported by all modern browsers
124+
- Some images may not benefit from conversion (already optimized PNGs)
125+
- Consider keeping originals if they're source files for editing

.claude/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@
1919
},
2020
"env": {
2121
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000"
22+
},
23+
"autoApprove": {
24+
"write": true,
25+
"edit": true
2226
}
2327
}

.github/workflows/format-with-prettier.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ jobs:
2626
- name: Install dependencies
2727
run: npm ci
2828

29-
- name: Run Prettier check
30-
run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,scss,md,html,yml,yaml}"
29+
- name: Run Prettier write
30+
run: npx prettier --write "**/*.{js,jsx,ts,tsx,json,css,scss,md,html,yml,yaml}"

.github/workflows/update-algolia.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Run Algolia Crawler
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Allow one concurrent deployment
12+
concurrency:
13+
group: 'algolia'
14+
cancel-in-progress: true
15+
16+
env:
17+
BASE_URL: '/'
18+
19+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
20+
jobs:
21+
publish:
22+
runs-on: ubuntu-latest
23+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Get the content of algolia.json as config
28+
id: algolia_config
29+
run: echo "::set-output name=config::$(cat algolia/config.json | jq -r tostring)"
30+
31+
- name: Push indices to Algolia
32+
uses: signcl/docsearch-scraper-action@master
33+
env:
34+
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
35+
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
36+
CONFIG: ${{ steps.algolia_config.outputs.config }}

0 commit comments

Comments
 (0)