tailwind-bundle icon indicating copy to clipboard operation
tailwind-bundle copied to clipboard

Add Extra Time to Builder

Open TheBuggs opened this issue 11 months ago • 0 comments

I have a problem when using a package in my test environment to check all dependencies. When I have many different CSS files, the build process takes more time because the process duration, which is around 60 seconds, is not stable, causing my deployment to crash. I have added extra time (add 10 min), but can you add functionality to configure this through a config file or suggest another simple solution?

I will provide my workaround:

composer.json

    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "importmap:install": "symfony-cmd"
        },
        "update-timeout": [
            "php update_timeout.php"
        ],
        "post-install-cmd": [
            "@auto-scripts",
            "@update-timeout"
        ],
        "post-update-cmd": [
            "@auto-scripts",
            "@update-timeout"
        ]
    },

update_time.php


<?php

function updateTimeout($filePath): void
{
    $fileContents = file_get_contents($filePath);

    if ($fileContents === false) {
        die("Error: Unable to read the file at $filePath");
    }

    $lines = explode(PHP_EOL, $fileContents);
    $newLines = [];
    $lineToAdd = '$process->setTimeout(600);';

    foreach ($lines as $line) {
        $newLines[] = $line;

        if (trim($line) === '$process = $binary->createProcess($arguments);') {
            $newLines[] = $lineToAdd;
        }
    }

    $updatedContents = implode(PHP_EOL, $newLines);
    $result = file_put_contents($filePath, $updatedContents);

    if ($result === false) {
        die("Error: Unable to write to the file at $filePath");
    }

    echo "Timeout added successfully in $filePath.\n";
}

$filePath = __DIR__ . '/vendor/symfonycasts/tailwind-bundle/src/TailwindBuilder.php';
updateTimeout($filePath);

Thanks a lot!

TheBuggs avatar Mar 14 '25 14:03 TheBuggs