mirror of
https://github.com/Dokploy/templates.git
synced 2026-05-01 23:08:56 -05:00
* removed n8n (appears 2 times) Authelia (appears 2 times) SupaBase (appears 2 times) Livekit (appears 2 times) WG-Easy (appears 2 times) Open Notebook (appears 2 times) Booklore (appears 2 times) Scrypted (appears 2 times) Wallos (appears 2 times) Statping-NG (appears 2 times) * Replace application catalog entries with new software entries * Test 1 * Updated Scripts * Final Test * Fix * Remove redundant dependency installation steps from GitHub Actions workflow * Test 2 * Update meta sorting logic to ASCII order and add --backup option for deduplication * Fix meta.json: Remove duplicates and apply correct ASCII sorting - Remove duplicate entries: scrypted, searxng (243 → 241 entries) - Fix sorting algorithm to use ASCII order for CI/CD compatibility - Update both dedupe-and-sort-meta.js and build-scripts/process-meta.js - Add missing --backup CLI argument to build script - Ensure consistent sorting across all processing interfaces * Fix CI/CD pipeline: Count JSON entries instead of lines - Update validate-meta.yml to count JSON entries using Node.js instead of wc -l - Add custom JSON formatting functions to both processing scripts - Ensure consistent output formatting across all processing interfaces - Fix false positive where line count increased due to expanded JSON formatting The CI/CD failure was caused by counting file lines (4124) instead of actual JSON entries (241). Both files now produce identical results with proper entry counting in the validation workflow. * Fix meta.json formatting to match processing script output - Apply consistent JSON formatting to meta.json using processing script - Ensure file formatting matches expected CI/CD workflow output - Files now pass diff comparison in validation workflow This resolves the CI/CD pipeline failure where files had identical content but different formatting, causing diff validation to fail. * Test 3 * Removed duplicate and action worked :) * Remove pull_request_template.md * Remove duplicate meta entries to prevent processing conflicts --------- Co-authored-by: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
228 lines
4.8 KiB
Markdown
228 lines
4.8 KiB
Markdown
# Meta.json Processing Tools
|
|
|
|
This directory contains production-ready tools for processing `meta.json` files, specifically designed to:
|
|
|
|
- ✅ Remove duplicate entries based on `id` field
|
|
- 🔤 Sort entries alphabetically by `id`
|
|
- 🛡️ Validate JSON structure and required fields
|
|
- 💾 Create automatic backups before processing
|
|
- 🚀 Integrate with CI/CD pipelines
|
|
|
|
## Quick Start
|
|
|
|
### Simple Processing
|
|
|
|
```bash
|
|
# Process meta.json (removes duplicates, sorts alphabetically)
|
|
node dedupe-and-sort-meta.js
|
|
|
|
# Or using npm
|
|
npm run process-meta
|
|
```
|
|
|
|
### Advanced Processing
|
|
|
|
```bash
|
|
# Verbose output with validation
|
|
node build-scripts/process-meta.js --verbose
|
|
|
|
# Process different file
|
|
node build-scripts/process-meta.js --input data/meta.json --output dist/meta.json
|
|
|
|
# No backup creation
|
|
node build-scripts/process-meta.js --no-backup
|
|
```
|
|
|
|
### Using Make
|
|
|
|
```bash
|
|
# Process meta.json
|
|
make process-meta
|
|
|
|
# Validate without changes
|
|
make validate
|
|
|
|
# Quick check for issues
|
|
make check
|
|
|
|
# Full build process
|
|
make build
|
|
```
|
|
|
|
## Available Scripts
|
|
|
|
### Core Scripts
|
|
|
|
1. **`dedupe-and-sort-meta.js`** - Simple, standalone script
|
|
|
|
- Removes duplicates (keeps first occurrence)
|
|
- Sorts alphabetically by ID
|
|
- Creates automatic backup
|
|
- Provides processing statistics
|
|
|
|
2. **`build-scripts/process-meta.js`** - Production-ready script
|
|
- All features of the simple script
|
|
- Schema validation
|
|
- Configurable options
|
|
- CLI argument parsing
|
|
- Detailed logging
|
|
|
|
### NPM Scripts
|
|
|
|
```json
|
|
{
|
|
"process-meta": "Remove duplicates and sort meta.json",
|
|
"process-meta-verbose": "Process with detailed output",
|
|
"validate-meta": "Validate structure without changes",
|
|
"build": "Full production build process"
|
|
}
|
|
```
|
|
|
|
### Make Targets
|
|
|
|
- `make process-meta` - Process the meta.json file
|
|
- `make validate` - Validate without modifying
|
|
- `make check` - Quick duplicate/sort check
|
|
- `make build` - Full build process
|
|
- `make clean` - Remove backup files
|
|
|
|
## CLI Options
|
|
|
|
```bash
|
|
Usage: node build-scripts/process-meta.js [options]
|
|
|
|
Options:
|
|
-i, --input <file> Input file path (default: meta.json)
|
|
-o, --output <file> Output file path (default: same as input)
|
|
--no-backup Don't create backup file
|
|
-v, --verbose Verbose output
|
|
--no-schema-validation Skip schema validation
|
|
-h, --help Show help message
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Basic Usage
|
|
|
|
```bash
|
|
# Process current meta.json
|
|
node dedupe-and-sort-meta.js
|
|
|
|
# Output:
|
|
# 🔧 Processing meta.json...
|
|
# 📊 Found 241 total entries
|
|
# 💾 Backup created: meta.json.backup.1755066142618
|
|
# ✅ Processing completed successfully!
|
|
# 📈 Statistics:
|
|
# • Original entries: 241
|
|
# • Duplicates removed: 0
|
|
# • Final entries: 241
|
|
# • Entries sorted alphabetically by ID
|
|
# 🔤 ID range: ackee ... zitadel
|
|
```
|
|
|
|
### Production Build Integration
|
|
|
|
```bash
|
|
# In your CI/CD pipeline
|
|
npm run build
|
|
|
|
# Or with Make
|
|
make build
|
|
```
|
|
|
|
### Validation Only
|
|
|
|
```bash
|
|
# Check for issues without modifying
|
|
make validate
|
|
|
|
# Or with node directly
|
|
node build-scripts/process-meta.js --no-backup --verbose --output /tmp/test.json
|
|
```
|
|
|
|
## CI/CD Integration
|
|
|
|
### GitHub Actions
|
|
|
|
The included `.github/workflows/validate-meta.yml` workflow automatically:
|
|
|
|
- ✅ Validates JSON structure
|
|
- 🔍 Checks for duplicates
|
|
- 📋 Verifies required fields
|
|
- 🔤 Ensures alphabetical sorting
|
|
- ❌ Fails build if issues found
|
|
|
|
### Integration Examples
|
|
|
|
**Docker Build:**
|
|
|
|
```dockerfile
|
|
COPY package.json ./
|
|
COPY dedupe-and-sort-meta.js ./
|
|
COPY meta.json ./
|
|
RUN npm run process-meta
|
|
```
|
|
|
|
**Shell Script:**
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
echo "Processing meta.json for production..."
|
|
node dedupe-and-sort-meta.js
|
|
if [ $? -eq 0 ]; then
|
|
echo "✅ Meta.json processed successfully"
|
|
else
|
|
echo "❌ Meta.json processing failed"
|
|
exit 1
|
|
fi
|
|
```
|
|
|
|
## Schema Validation
|
|
|
|
The tools validate these required fields:
|
|
|
|
- `id` (string, unique)
|
|
- `name` (string)
|
|
- `version` (string)
|
|
- `description` (string)
|
|
- `links` (object with github property)
|
|
- `logo` (string)
|
|
- `tags` (array)
|
|
|
|
## Backup Strategy
|
|
|
|
- Automatic backups created with timestamp: `meta.json.backup.{timestamp}`
|
|
- Backups can be disabled with `--no-backup` flag
|
|
- Use `make clean` to remove old backup files
|
|
|
|
## Performance
|
|
|
|
- Processes 240+ entries in ~50ms
|
|
- Memory efficient (streams JSON)
|
|
- No external dependencies required
|
|
- Node.js 14+ compatible
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
1. **File not found**: Ensure `meta.json` exists in current directory
|
|
2. **Invalid JSON**: Check JSON syntax with `node -c meta.json`
|
|
3. **Permission denied**: Check file write permissions
|
|
4. **Duplicates found**: Review duplicate entries in output logs
|
|
|
|
### Debug Mode
|
|
|
|
```bash
|
|
# Enable verbose logging
|
|
node build-scripts/process-meta.js --verbose
|
|
|
|
# Check file quickly
|
|
make check
|
|
```
|
|
|
|
## License
|
|
|
|
MIT License - See project root for details.
|