refactor(scripts): reorganize scripts/ into seed/ and validate/ subfolders
Move 9 init/seed scripts into scripts/seed/ and 7 validation scripts (+ validators/ subfolder) into scripts/validate/ to reduce clutter in the root scripts/ directory. Update all references across Makefile, CI/CD configs, pre-commit hooks, docs (~40 files), and Python imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
52
Makefile
52
Makefile
@@ -105,19 +105,19 @@ init-prod:
|
||||
@$(PYTHON) -m alembic upgrade heads
|
||||
@echo ""
|
||||
@echo "Step 1/6: Creating admin user and platform settings..."
|
||||
$(PYTHON) scripts/init_production.py
|
||||
$(PYTHON) scripts/seed/init_production.py
|
||||
@echo ""
|
||||
@echo "Step 2/6: Initializing log settings..."
|
||||
$(PYTHON) scripts/init_log_settings.py
|
||||
$(PYTHON) scripts/seed/init_log_settings.py
|
||||
@echo ""
|
||||
@echo "Step 3/6: Creating default CMS content pages..."
|
||||
$(PYTHON) scripts/create_default_content_pages.py
|
||||
$(PYTHON) scripts/seed/create_default_content_pages.py
|
||||
@echo ""
|
||||
@echo "Step 4/6: Creating platform pages and landing..."
|
||||
$(PYTHON) scripts/create_platform_pages.py
|
||||
$(PYTHON) scripts/seed/create_platform_pages.py
|
||||
@echo ""
|
||||
@echo "Step 5/6: Seeding email templates..."
|
||||
$(PYTHON) scripts/seed_email_templates.py
|
||||
$(PYTHON) scripts/seed/seed_email_templates.py
|
||||
@echo ""
|
||||
@echo "Step 6/6: Seeding subscription tiers..."
|
||||
@echo " (Handled by init_production.py Step 6)"
|
||||
@@ -127,40 +127,40 @@ init-prod:
|
||||
|
||||
seed-tiers:
|
||||
@echo "🏷️ Seeding subscription tiers..."
|
||||
$(PYTHON) -c "from scripts.init_production import *; from app.core.database import SessionLocal; from sqlalchemy import select; db = SessionLocal(); oms = db.execute(select(Platform).where(Platform.code == 'oms')).scalar_one_or_none(); create_subscription_tiers(db, oms) if oms else print('OMS platform not found'); db.commit(); db.close()"
|
||||
$(PYTHON) -c "from scripts.seed.init_production import *; from app.core.database import SessionLocal; from sqlalchemy import select; db = SessionLocal(); oms = db.execute(select(Platform).where(Platform.code == 'oms')).scalar_one_or_none(); create_subscription_tiers(db, oms) if oms else print('OMS platform not found'); db.commit(); db.close()"
|
||||
@echo "✅ Subscription tiers seeded"
|
||||
|
||||
# First-time installation - Complete setup with configuration validation
|
||||
platform-install:
|
||||
@echo "🚀 WIZAMART PLATFORM INSTALLATION"
|
||||
@echo "=================================="
|
||||
$(PYTHON) scripts/install.py
|
||||
$(PYTHON) scripts/seed/install.py
|
||||
|
||||
# Demo data seeding - Cross-platform using Python to set environment
|
||||
seed-demo:
|
||||
@echo "🎪 Seeding demo data (normal mode)..."
|
||||
ifeq ($(DETECTED_OS),Windows)
|
||||
@set SEED_MODE=normal&& $(PYTHON) scripts/seed_demo.py
|
||||
@set SEED_MODE=normal&& $(PYTHON) scripts/seed/seed_demo.py
|
||||
else
|
||||
SEED_MODE=normal $(PYTHON) scripts/seed_demo.py
|
||||
SEED_MODE=normal $(PYTHON) scripts/seed/seed_demo.py
|
||||
endif
|
||||
@echo "✅ Demo seeding completed"
|
||||
|
||||
seed-demo-minimal:
|
||||
@echo "🎪 Seeding demo data (minimal mode - 1 store only)..."
|
||||
ifeq ($(DETECTED_OS),Windows)
|
||||
@set SEED_MODE=minimal&& $(PYTHON) scripts/seed_demo.py
|
||||
@set SEED_MODE=minimal&& $(PYTHON) scripts/seed/seed_demo.py
|
||||
else
|
||||
SEED_MODE=minimal $(PYTHON) scripts/seed_demo.py
|
||||
SEED_MODE=minimal $(PYTHON) scripts/seed/seed_demo.py
|
||||
endif
|
||||
@echo "✅ Minimal demo seeding completed"
|
||||
|
||||
seed-demo-reset:
|
||||
@echo "⚠️ WARNING: This will DELETE ALL existing data!"
|
||||
ifeq ($(DETECTED_OS),Windows)
|
||||
@set SEED_MODE=reset&& $(PYTHON) scripts/seed_demo.py
|
||||
@set SEED_MODE=reset&& $(PYTHON) scripts/seed/seed_demo.py
|
||||
else
|
||||
SEED_MODE=reset $(PYTHON) scripts/seed_demo.py
|
||||
SEED_MODE=reset $(PYTHON) scripts/seed/seed_demo.py
|
||||
endif
|
||||
|
||||
db-setup: migrate-up init-prod seed-demo
|
||||
@@ -175,34 +175,34 @@ db-reset:
|
||||
@echo "Applying all migrations..."
|
||||
$(PYTHON) -m alembic upgrade head
|
||||
@echo "Initializing production data..."
|
||||
$(PYTHON) scripts/init_production.py
|
||||
$(PYTHON) scripts/seed/init_production.py
|
||||
@echo "Seeding demo data..."
|
||||
ifeq ($(DETECTED_OS),Windows)
|
||||
@set SEED_MODE=reset&& set FORCE_RESET=true&& $(PYTHON) scripts/seed_demo.py
|
||||
@set SEED_MODE=reset&& set FORCE_RESET=true&& $(PYTHON) scripts/seed/seed_demo.py
|
||||
else
|
||||
SEED_MODE=reset FORCE_RESET=true $(PYTHON) scripts/seed_demo.py
|
||||
SEED_MODE=reset FORCE_RESET=true $(PYTHON) scripts/seed/seed_demo.py
|
||||
endif
|
||||
@echo ""
|
||||
@echo "✅ Database completely reset!"
|
||||
|
||||
backup-db:
|
||||
@echo "Creating database backup..."
|
||||
@$(PYTHON) scripts/backup_database.py
|
||||
@$(PYTHON) scripts/seed/backup_database.py
|
||||
|
||||
# Utility commands (usually not needed - init-prod handles these)
|
||||
create-cms-defaults:
|
||||
@echo "📄 Creating default CMS content pages..."
|
||||
$(PYTHON) scripts/create_default_content_pages.py
|
||||
$(PYTHON) scripts/seed/create_default_content_pages.py
|
||||
@echo "✅ CMS defaults created"
|
||||
|
||||
create-platform-pages:
|
||||
@echo "🏠 Creating platform pages and landing..."
|
||||
$(PYTHON) scripts/create_platform_pages.py
|
||||
$(PYTHON) scripts/seed/create_platform_pages.py
|
||||
@echo "✅ Platform pages created"
|
||||
|
||||
init-logging:
|
||||
@echo "📝 Initializing log settings..."
|
||||
$(PYTHON) scripts/init_log_settings.py
|
||||
$(PYTHON) scripts/seed/init_log_settings.py
|
||||
@echo "✅ Log settings initialized"
|
||||
|
||||
# =============================================================================
|
||||
@@ -325,31 +325,31 @@ ci: lint-strict verify-imports test-coverage
|
||||
|
||||
verify-imports:
|
||||
@echo "Verifying critical imports..."
|
||||
$(PYTHON) scripts/verify_critical_imports.py
|
||||
$(PYTHON) scripts/validate/verify_critical_imports.py
|
||||
|
||||
arch-check:
|
||||
@echo "Running architecture validation..."
|
||||
$(PYTHON) scripts/validate_architecture.py
|
||||
$(PYTHON) scripts/validate/validate_architecture.py
|
||||
|
||||
arch-check-file:
|
||||
ifeq ($(DETECTED_OS),Windows)
|
||||
@if "$(file)"=="" (echo Error: Please provide a file. Usage: make arch-check-file file="path/to/file.py") else ($(PYTHON) scripts/validate_architecture.py -f "$(file)")
|
||||
@if "$(file)"=="" (echo Error: Please provide a file. Usage: make arch-check-file file="path/to/file.py") else ($(PYTHON) scripts/validate/validate_architecture.py -f "$(file)")
|
||||
else
|
||||
@if [ -z "$(file)" ]; then \
|
||||
echo "Error: Please provide a file. Usage: make arch-check-file file=\"path/to/file.py\""; \
|
||||
else \
|
||||
$(PYTHON) scripts/validate_architecture.py -f "$(file)"; \
|
||||
$(PYTHON) scripts/validate/validate_architecture.py -f "$(file)"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
arch-check-object:
|
||||
ifeq ($(DETECTED_OS),Windows)
|
||||
@if "$(name)"=="" (echo Error: Please provide an object name. Usage: make arch-check-object name="merchant") else ($(PYTHON) scripts/validate_architecture.py -o "$(name)")
|
||||
@if "$(name)"=="" (echo Error: Please provide an object name. Usage: make arch-check-object name="merchant") else ($(PYTHON) scripts/validate/validate_architecture.py -o "$(name)")
|
||||
else
|
||||
@if [ -z "$(name)" ]; then \
|
||||
echo "Error: Please provide an object name. Usage: make arch-check-object name=\"merchant\""; \
|
||||
else \
|
||||
$(PYTHON) scripts/validate_architecture.py -o "$(name)"; \
|
||||
$(PYTHON) scripts/validate/validate_architecture.py -o "$(name)"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user