From 7b89c92966e6a0cea4a9dace0ac7b9b343ed51b2 Mon Sep 17 00:00:00 2001 From: Malin Date: Tue, 23 Dec 2025 08:23:39 +0100 Subject: [PATCH] Remove development files from repository - keep only production plugin files --- .gitignore | 11 ++-- VENDOR-SETUP.md | 162 ----------------------------------------------- composer.json | 37 ----------- setup-vendor.bat | 62 ------------------ setup-vendor.sh | 63 ------------------ 5 files changed, 6 insertions(+), 329 deletions(-) delete mode 100644 VENDOR-SETUP.md delete mode 100644 composer.json delete mode 100644 setup-vendor.bat delete mode 100755 setup-vendor.sh diff --git a/.gitignore b/.gitignore index e3d2986d..50ba2932 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ -# Composer (keep composer.lock, include vendor for distribution) +# Development files - exclude from distribution +composer.json composer.lock - -# Development only - uncomment if you want to exclude vendor in dev -# /vendor/composer/ -# /vendor/autoload_real.php +composer.phar +setup-vendor.sh +setup-vendor.bat +VENDOR-SETUP.md # WordPress .DS_Store diff --git a/VENDOR-SETUP.md b/VENDOR-SETUP.md deleted file mode 100644 index a133f4ed..00000000 --- a/VENDOR-SETUP.md +++ /dev/null @@ -1,162 +0,0 @@ -# Vendor Library Setup Guide - -You have two options to include the Google API Client library: - -## Option 1: Manual Download (Recommended for Distribution) - -This is the easiest method and doesn't require Composer. - -### Step 1: Download Google API PHP Client - -1. Go to: https://github.com/googleapis/google-api-php-client/releases -2. Download the latest release (e.g., `google-api-php-client-2.15.0.zip`) -3. Extract the ZIP file - -### Step 2: Copy to Vendor Directory - -Copy the extracted files into your plugin's `vendor/` directory following this structure: - -``` -vendor/ -├── autoload.php (already exists in plugin) -├── google/ -│ ├── apiclient/ -│ │ ├── src/ -│ │ │ └── Google/ -│ │ │ ├── Client.php -│ │ │ ├── Service/ -│ │ │ └── ... (all Google API files) -│ │ └── ... -│ └── apiclient-services/ -│ ├── autoload.php -│ └── src/ -│ └── Google/ -│ └── Service/ -│ └── ShoppingContent/ -│ └── ... (Shopping API files) -├── guzzlehttp/ -│ ├── guzzle/ -│ │ └── src/ -│ ├── psr7/ -│ │ └── src/ -│ └── promises/ -│ └── src/ -├── psr/ -│ ├── http-message/src/ -│ ├── http-client/src/ -│ ├── cache/src/ -│ └── log/Psr/Log/ -├── firebase/ -│ └── php-jwt/src/ -└── monolog/ - └── monolog/src/Monolog/ -``` - -### Step 3: Quick Copy Instructions - -If you downloaded the Google API Client via Composer once, you can simply copy the entire vendor directory: - -```bash -# Run composer install once (on your development machine) -composer install - -# Then copy the entire vendor directory to your plugin -# The plugin's custom autoloader will handle everything -``` - -The vendor directory will be about 10-15 MB, which is perfectly fine for WordPress plugin distribution. - -## Option 2: Use Composer (For Development) - -If you're actively developing the plugin: - -```bash -cd /path/to/plugin -composer install -``` - -This will: -- Download all dependencies -- Generate an optimized autoloader -- Create `vendor/autoload_real.php` - -The plugin's autoloader (`vendor/autoload.php`) automatically detects and uses Composer's autoloader if available. - -## Verifying Installation - -After setting up the vendor directory, check that these files exist: - -1. `vendor/google/apiclient/src/Google/Client.php` -2. `vendor/google/apiclient-services/src/Google/Service/ShoppingContent.php` -3. `vendor/guzzlehttp/guzzle/src/Client.php` - -If these files exist, the plugin will work correctly! - -## For Plugin Distribution - -When distributing your plugin (e.g., to clients or WordPress.org): - -1. **Include the vendor directory** in your plugin ZIP -2. Users simply upload and activate - no Composer needed -3. The custom autoloader handles everything automatically - -This is the standard practice for WordPress plugins - most popular plugins include their dependencies rather than requiring Composer. - -## Simplified Download Script - -Want to automate this? Run this in your plugin directory: - -```bash -#!/bin/bash -# Download and setup Google API Client - -# Install via Composer (easiest way to get all dependencies) -composer install --no-dev --optimize-autoloader - -# Remove Composer development files (optional) -rm -rf vendor/bin -rm -rf vendor/composer/*.json - -echo "Google API Client installed successfully!" -echo "You can now distribute the plugin with the vendor directory included." -``` - -## File Size Note - -The complete vendor directory with Google API Client and dependencies is approximately: -- **Uncompressed**: 10-15 MB -- **ZIP compressed**: 2-3 MB - -This is acceptable for WordPress plugin distribution and much easier than requiring users to run Composer. - -## Troubleshooting - -### "Google API Client library is missing" error - -If you see this error in WordPress admin: - -1. Check that `vendor/google/apiclient/src/Google/Client.php` exists -2. Verify file permissions (should be readable by web server) -3. Check that the autoloader is being loaded (check plugin main file) - -### Class not found errors - -If you get "Class 'Google_Service_ShoppingContent' not found": - -1. Ensure `vendor/google/apiclient-services/` exists -2. Check that Shopping Content service is included in apiclient-services -3. You may need to download the services separately from: https://github.com/googleapis/google-api-php-client-services - -## Minimal Installation (Advanced) - -If you want to reduce file size, you can include only the required services: - -1. Install full Google API Client -2. Keep only these directories: - - `google/apiclient/` - - `google/apiclient-services/src/Google/Service/ShoppingContent/` - - `guzzlehttp/` (all) - - `psr/` (all) - - `firebase/php-jwt/` - -This reduces the size to ~5 MB while keeping all necessary functionality. diff --git a/composer.json b/composer.json deleted file mode 100644 index 6414ed9a..00000000 --- a/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "informatiq/smart-google-pricing", - "description": "WooCommerce plugin for automated pricing based on Google Merchant Center data", - "type": "wordpress-plugin", - "license": "GPL-2.0-or-later", - "authors": [ - { - "name": "Mălin Cenușă", - "email": "contact@malin.ro", - "homepage": "https://malin.ro" - } - ], - "require": { - "php": ">=7.4", - "google/apiclient": "^2.15" - }, - "autoload": { - "psr-4": { - "Informatiq\\SmartPricing\\": "includes/" - } - }, - "config": { - "optimize-autoloader": true, - "sort-packages": true, - "allow-plugins": { - "composer/installers": true - } - }, - "minimum-stability": "stable", - "prefer-stable": true, - "scripts": { - "post-install-cmd": [ - "@php -r \"echo '\\n✓ Google API Client installed successfully!\\n';\"", - "@php -r \"echo 'You can now distribute the plugin with vendor/ directory included.\\n';\"" - ] - } -} diff --git a/setup-vendor.bat b/setup-vendor.bat deleted file mode 100644 index a3d621c2..00000000 --- a/setup-vendor.bat +++ /dev/null @@ -1,62 +0,0 @@ -@echo off -REM Setup script for Google API Client library (Windows) -REM This script downloads and installs the Google API Client using Composer -REM -REM Usage: setup-vendor.bat -REM - -echo ================================================ -echo Informatiq Smart Google Pricing - Vendor Setup -echo ================================================ -echo. - -REM Check if composer is installed -where composer >nul 2>nul -if %errorlevel% neq 0 ( - echo X Composer is not installed. - echo. - echo Please install Composer from https://getcomposer.org - echo Or manually download Google API Client from: - echo https://github.com/googleapis/google-api-php-client/releases - echo. - pause - exit /b 1 -) - -echo √ Composer found -echo. - -REM Check if vendor directory already exists with Google Client -if exist "vendor\google\apiclient\src\Google\Client.php" ( - echo √ Google API Client is already installed - echo. - set /p reinstall="Do you want to reinstall? (y/N): " - if /i not "%reinstall%"=="y" ( - echo Setup cancelled. - pause - exit /b 0 - ) - echo. -) - -echo Installing Google API Client and dependencies... -echo. - -REM Install dependencies -composer install --no-dev --optimize-autoloader - -echo. -echo ================================================ -echo √ Installation Complete! -echo ================================================ -echo. -echo Google API Client has been installed to vendor\ -echo. -echo Next steps: -echo 1. Upload the entire plugin directory to WordPress -echo 2. Activate the plugin -echo 3. Configure settings at WooCommerce ^> Smart Pricing -echo. -echo The plugin is now ready for distribution! -echo. -pause diff --git a/setup-vendor.sh b/setup-vendor.sh deleted file mode 100755 index 5e114820..00000000 --- a/setup-vendor.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# Setup script for Google API Client library -# This script downloads and installs the Google API Client using Composer -# -# Usage: ./setup-vendor.sh -# - -set -e - -echo "================================================" -echo "Informatiq Smart Google Pricing - Vendor Setup" -echo "================================================" -echo "" - -# Check if composer is installed -if ! command -v composer &> /dev/null; then - echo "❌ Composer is not installed." - echo "" - echo "Please install Composer from https://getcomposer.org" - echo "Or manually download Google API Client from:" - echo "https://github.com/googleapis/google-api-php-client/releases" - echo "" - exit 1 -fi - -echo "✓ Composer found" -echo "" - -# Check if vendor directory already exists with Google Client -if [ -f "vendor/google/apiclient/src/Google/Client.php" ]; then - echo "✓ Google API Client is already installed" - echo "" - read -p "Do you want to reinstall? (y/N): " -n 1 -r - echo "" - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - echo "Setup cancelled." - exit 0 - fi - echo "" -fi - -echo "Installing Google API Client and dependencies..." -echo "" - -# Install dependencies -composer install --no-dev --optimize-autoloader - -echo "" -echo "================================================" -echo "✓ Installation Complete!" -echo "================================================" -echo "" -echo "Google API Client has been installed to vendor/" -echo "Directory size: $(du -sh vendor/ | cut -f1)" -echo "" -echo "Next steps:" -echo "1. Upload the entire plugin directory to WordPress" -echo "2. Activate the plugin" -echo "3. Configure settings at WooCommerce > Smart Pricing" -echo "" -echo "The plugin is now ready for distribution!" -echo ""