From ff835019045f404b559647717d3e16fb4299fc74 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 25 Oct 2025 18:35:29 -0600 Subject: [PATCH] Remove Makefile, README, and script.js for meta.json processing; update package.json to reflect changes in scripts. --- Makefile | 45 -------- README-meta-processing.md | 227 -------------------------------------- package.json | 2 - script.js | 0 4 files changed, 274 deletions(-) delete mode 100644 Makefile delete mode 100644 README-meta-processing.md delete mode 100644 script.js diff --git a/Makefile b/Makefile deleted file mode 100644 index e43b4a51..00000000 --- a/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# Makefile for meta.json processing - -.PHONY: help process-meta validate build clean install - -# Default target -help: - @echo "Available targets:" - @echo " process-meta - Remove duplicates and sort meta.json alphabetically" - @echo " validate - Validate meta.json structure and content" - @echo " build - Run full build process (includes process-meta)" - @echo " install - Install Node.js dependencies" - @echo " clean - Remove backup files and temporary files" - @echo " help - Show this help message" - -# Install dependencies -install: - @echo "๐Ÿ“ฆ Installing dependencies..." - @if [ -f package.json ]; then npm install; else echo "No package.json found, skipping..."; fi - -# Process meta.json - remove duplicates and sort alphabetically -process-meta: - @echo "๐Ÿ”ง Processing meta.json..." - @node dedupe-and-sort-meta.js - -# Validate meta.json without modifying it -validate: - @echo "๐Ÿ” Validating meta.json..." - @node build-scripts/process-meta.js --verbose --no-backup --output /tmp/meta-validation.json - @echo "โœ… Validation completed" - -# Full build process -build: process-meta - @echo "๐Ÿ—๏ธ Build process completed" - -# Clean backup and temporary files -clean: - @echo "๐Ÿงน Cleaning up..." - @find . -name "meta.json.backup.*" -type f -delete 2>/dev/null || true - @rm -f /tmp/meta-*.json 2>/dev/null || true - @echo "โœ… Cleanup completed" - -# Quick check if meta.json needs processing -check: - @echo "๐Ÿ” Quick check for duplicates and sort order..." - @node -e "const fs=require('fs');const d=JSON.parse(fs.readFileSync('meta.json','utf8'));const ids=d.map(i=>i.id);const unique=new Set(ids);console.log('Entries:',d.length,'Unique:',unique.size,'Duplicates:',d.length-unique.size);const sorted=[...ids].sort((a,b)=>a.toLowerCase().localeCompare(b.toLowerCase()));console.log('Sorted:',JSON.stringify(ids)===JSON.stringify(sorted)?'โœ…':'โŒ');" \ No newline at end of file diff --git a/README-meta-processing.md b/README-meta-processing.md deleted file mode 100644 index daf8d505..00000000 --- a/README-meta-processing.md +++ /dev/null @@ -1,227 +0,0 @@ -# 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 Input file path (default: meta.json) - -o, --output 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. diff --git a/package.json b/package.json index 70bf05ef..62468436 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,6 @@ "main": "build-scripts/process-meta.js", "scripts": { "process-meta": "node dedupe-and-sort-meta.js", - "process-meta-verbose": "node build-scripts/process-meta.js --verbose", - "process-meta-with-backup": "node build-scripts/process-meta.js --backup", "validate-meta": "node build-scripts/process-meta.js --no-backup --verbose", "build": "npm run process-meta", "prebuild": "echo 'Processing meta.json for production build...'", diff --git a/script.js b/script.js deleted file mode 100644 index e69de29b..00000000