feat(ocr): add whitelist presets and improve UI for OCR tool

refactor: format code and improve mobile menu accessibility
style: fix whitespace and formatting in multiple files
docs: update documentation with better formatting and examples
This commit is contained in:
abdullahalam123
2025-10-20 18:51:49 +05:30
parent 59b351eee4
commit 0e7c53560a
19 changed files with 755 additions and 363 deletions

View File

@@ -7,6 +7,7 @@
**Situation:** You've completed a new feature, tested it locally, and want to release it.
**Current State:**
```bash
$ git status
On branch main
@@ -22,6 +23,7 @@ Untracked files:
```
**Steps:**
```bash
# 1. Commit your feature changes
git add .
@@ -34,6 +36,7 @@ npm run release:major # Major: 1.0.0 → 2.0.0 (breaking changes)
```
**What Happens:**
- ✅ Your feature commit stays as-is
- ✅ Version gets bumped in `package.json`
- ✅ New release commit is created
@@ -48,6 +51,7 @@ npm run release:major # Major: 1.0.0 → 2.0.0 (breaking changes)
**Situation:** You have local changes but haven't committed them yet.
**Current State:**
```bash
$ git status
Changes not staged for commit:
@@ -57,6 +61,7 @@ Changes not staged for commit:
```
**❌ This Will Fail:**
```bash
npm run release
# Error: Your local changes would be overwritten by merge
@@ -65,6 +70,7 @@ npm run release
**✅ Solution Options:**
**Option A: Commit Everything First (Recommended)**
```bash
git add .
git commit -m "Add new features and improvements"
@@ -72,6 +78,7 @@ npm run release
```
**Option B: Stash Changes Temporarily**
```bash
git stash
npm run release
@@ -79,6 +86,7 @@ git stash pop # Restore your changes after release
```
**Option C: Commit Only What's Needed**
```bash
git add package.json src/js/main.js
git commit -m "Add core improvements"
@@ -94,6 +102,7 @@ git commit -m "Update documentation"
**Situation:** There's a critical bug in production that needs immediate fixing.
**Steps:**
```bash
# 1. Fix the bug
git add src/js/bug-fix.js
@@ -105,6 +114,7 @@ npm run release
```
**Result:**
- ✅ Bug fix gets released immediately
- ✅ Docker image with fix is available
- ✅ Users can pull the fixed version
@@ -116,6 +126,7 @@ npm run release
**Situation:** You've added significant new features that might break existing functionality.
**Steps:**
```bash
# 1. Commit all your changes
git add .
@@ -127,6 +138,7 @@ npm run release:major
```
**Result:**
- ✅ Major version bump indicates breaking changes
- ✅ Users know to check compatibility
- ✅ Both old and new versions available
@@ -138,6 +150,7 @@ npm run release:major
**Situation:** You've been working on multiple features and want to release them together.
**Steps:**
```bash
# 1. Commit all features
git add .
@@ -156,6 +169,7 @@ npm run release:major # For breaking changes (1.0.0 → 2.0.0)
**Situation:** You want to test the release system without affecting production.
**Steps:**
```bash
# 1. Make a small test change
echo "// Test comment" >> src/js/main.js
@@ -179,23 +193,25 @@ git reset --hard HEAD~1
## 🎯 **Release Type Guidelines**
| Scenario | Command | Version Change | When to Use |
|----------|---------|----------------|-------------|
| **Bug Fix** | `npm run release` | `1.0.0 → 1.0.1` | Fixing bugs, small improvements |
| **New Feature** | `npm run release:minor` | `1.0.0 → 1.1.0` | Adding features, backward compatible |
| **Breaking Change** | `npm run release:major` | `1.0.0 → 2.0.0` | API changes, major rewrites |
| Scenario | Command | Version Change | When to Use |
| ------------------- | ----------------------- | --------------- | ------------------------------------ |
| **Bug Fix** | `npm run release` | `1.0.0 → 1.0.1` | Fixing bugs, small improvements |
| **New Feature** | `npm run release:minor` | `1.0.0 → 1.1.0` | Adding features, backward compatible |
| **Breaking Change** | `npm run release:major` | `1.0.0 → 2.0.0` | API changes, major rewrites |
---
## 🔄 **What Happens After You Run a Release Command**
### **Immediate Actions (Local):**
1. **Version Update**: `package.json` version gets bumped
2. **Git Commit**: New commit created with "Release vX.X.X"
3. **Git Tag**: Tag created (e.g., `v1.0.1`)
4. **Git Push**: Everything pushed to GitHub
### **Automatic Actions (GitHub):**
1. **GitHub Actions Triggered**: Workflow starts building Docker image
2. **Docker Build**: Multi-architecture image created
3. **Docker Push**: Images pushed to Docker Hub with tags:
@@ -204,7 +220,9 @@ git reset --hard HEAD~1
- `bentopdf/bentopdf:v1.0.1`
### **End Result:**
Users can immediately pull your new version:
```bash
docker pull bentopdf/bentopdf:1.0.1
```
@@ -214,6 +232,7 @@ docker pull bentopdf/bentopdf:1.0.1
## 🚨 **Before You Release - Prerequisites**
### **1. Docker Hub Credentials Setup**
You need to add these secrets to your GitHub repository:
1. Go to **Settings****Secrets and variables****Actions**
@@ -222,6 +241,7 @@ You need to add these secrets to your GitHub repository:
- `DOCKER_TOKEN`: Your Docker Hub access token
### **2. Get Docker Hub Token**
1. Go to [Docker Hub](https://hub.docker.com)
2. Account Settings → Security → New Access Token
3. Set permissions to "Read, Write, Delete"
@@ -232,8 +252,10 @@ You need to add these secrets to your GitHub repository:
## 🔧 **Troubleshooting Common Issues**
### **❌ "Your local changes would be overwritten by merge"**
**Problem:** You have uncommitted changes
**Solution:**
**Solution:**
```bash
git add .
git commit -m "Your commit message"
@@ -241,16 +263,20 @@ npm run release
```
### **❌ "Permission denied" in GitHub Actions**
**Problem:** Missing Docker Hub credentials
**Solution:** Add `DOCKER_USERNAME` and `DOCKER_TOKEN` to GitHub Secrets
### **❌ "Tag already exists"**
**Problem:** You've run the same release before
**Solution:** This is normal! The script will skip creating duplicate tags
### **❌ GitHub Actions fails**
**Problem:** Various build issues
**Solution:**
**Solution:**
1. Check Actions tab for detailed logs
2. Verify Docker Hub credentials
3. Check Dockerfile for syntax errors
@@ -260,6 +286,7 @@ npm run release
## 🧪 **Testing Your Release System**
### **Quick Test:**
```bash
# Make a small change
echo "// Test" >> src/js/main.js
@@ -269,12 +296,14 @@ npm run release
```
### **Verify Results:**
1. **GitHub Actions**: Check Actions tab for successful build
2. **Docker Hub**: Verify images are published
3. **Git Tags**: `git tag --list` should show new tag
4. **Version**: `cat package.json | grep version` should show updated version
### **Undo Test Release:**
```bash
git tag -d v1.0.1
git push origin :refs/tags/v1.0.1
@@ -286,5 +315,3 @@ git reset --hard HEAD~1
## 🎉 **That's It!**
Your release system is now ready! Just follow the scenarios above based on your situation and run the appropriate `npm run release` command.