{
    "name": "mkamelmasoud/composer.local",
    "description": "Custom dev scripts for my Laravel project",
    "license": "MIT",
    "type": "project",
    "scripts": {
        "clear-cache-composer-npm": [
            "composer clear-cache",
            "npm cache clean --force"
        ],
        "flush-redis": [
            "redis-cli -n 1 FLUSHDB"
        ],
        "setup-local-env": [
            "@clear-cache-composer-npm",
            "@setup-frontend-local",
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
            "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
            "@setup-backend-local",
            "@php artisan key:generate --ansi",
            "@wipe-db",
            "@ide-helper",
            "@optimize"
        ],
        "setup-frontend-local": [
            "rm -rf node_modules/ package-lock.lock",
            "npm install",
            "npm run build"
        ],
        "setup-backend-local": [
            "rm -rf vendor/ composer.lock",
            "php -r \"echo '\\033[32m>>> Using COMPOSER='.(getenv('COMPOSER') ?: 'composer.json').'\\033[0m'.PHP_EOL;\"",
            "php -r \"putenv('COMPOSER=composer.json'); passthru('composer install');\"",
            "@dump",
            "@optimize",
            "@phpstan"
        ],
        "dump": [
            "composer dump-autoload -o",
            "@optimize"
        ],
        "optimize": [
            "@php artisan optimize:clear --ansi"
        ],
        "wipe-db": [
            "redis-cli FLUSHALL",
            "@dump",
            "@php artisan db:wipe",
            "@php artisan migrate --seed --force"
        ],
        "migrate": [
            "redis-cli FLUSHALL",
            "@dump",
            "@php artisan migrate --force"
        ],
        "phpstan": [
            "./vendor/bin/pint",
            "./vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon.dist",
            "./vendor/bin/phpstan --configuration=phpstan.neon.dist --memory-limit=2G"
        ],
        "phpstan-analyse": [
            "./vendor/bin/pint --test",
            "./vendor/bin/phpstan analyse -c phpstan.neon.dist"
        ],
        "ide-helper": [
            "@php artisan ide-helper:generate",
            "@php artisan ide-helper:models"
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi",
            "@php artisan migrate --graceful --ansi"
        ],
        "php-test": "pest"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true,
            "phpstan/extension-installer": true,
            "wikimedia/composer-merge-plugin": true
        }
    }
}
