Skip to content

[ScriptExecutor] Ability to run Composer scripts #743

@Wirone

Description

@Wirone

Currently it's not possible to call other scripts defined in composer.json from auto-scripts definition. ScriptExecutor supports only Symfony commands, PHP scripts or raw scripts. Consider something like this:

{
     "scripts": {
        "auto-scripts": {
            "prepare-environment": "composer-script"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ],
        "prepare-environment": [
            "./bin/console cache:clear",
            // ... other scripts
        ],
    }
}

This would allow building better reusable scripts and automatic processes. Calling composer prepare-environment is much more clear than composer auto-scripts (with "cache:clear": "symfony-cmd" inside).

Alternative solution would be making auto-scripts configurable, so Flex would execute scripts from custom script like:

{
     "scripts": {
        "prepare-environment": {
            "cache:clear": "symfony-cmd"
        },
        "post-install-cmd": [
            "@prepare-environment"
        ],
        "post-update-cmd": [
            "@prepare-environment"
        ],
    },
    "extra": {
        "symfony": {
            "auto-scripts-source": "prepare-environment"
        },
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions