pantheon-systems / terminus-build-tools-plugin

Manage multidev environments for a Pantheon site using a GitHub PR workflow.
83 stars 68 forks source link

Spin out Built Tool Script commands from user's composer.json #383

Open aweingarten opened 3 years ago

aweingarten commented 3 years ago

When a fresh project is initialized with build-tools a large scripts session is added to composer.json. Most of these should be moved into terminus-build-tools or a build-tool-dependencies repo as robo-php commands. That way they can be maintained and updated and users can then get those updates via composer update terminus-build-tools instead of needing to manually edit their composer file.

"scripts": {
        "build-assets": [
            "@prepare-for-pantheon",
            "composer install --optimize-autoloader --no-dev"
        ],
        "lint": "find web/modules/custom web/themes/custom -name '*.php' -exec php -l {} \\;",
        "code-sniff": [
            "./vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore=node_modules,bower_components,vendor ./web/modules/custom",
            "./vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore=node_modules,bower_components,vendor ./web/themes/custom",
            "./vendor/bin/phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore=node_modules,bower_components,vendor ./web/modules/custom",
            "./vendor/bin/phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore=node_modules,bower_components,vendor ./web/themes/custom"
        ],
        "unit-test": "echo 'No unit test step defined.'",
        "prepare-for-pantheon": "DrupalProject\\composer\\ScriptHandler::prepareForPantheon",
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-create-project-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
greg-1-anderson commented 3 years ago

These scripts are meant to be customized, not maintained by the upstream.

aweingarten commented 3 years ago

These scripts are meant to be customized will create a support burden. As a customer I expect that the scripts in the pantheon template will continue to work. When they stop working, or fail to work as expected, I will file a support ticket and then I will require support time to update my configuration in very specific ways. It's a waste of everyones time. If we treat this like a product we can simply log that xyz is broken and update to the latest to fix it. This is a MUCH more maintainable and scalable approach.

greg-1-anderson commented 3 years ago

The scripts you are referring to are in an "example" repository. Pantheon example repositories are starting points that show customers how they can set up and maintain their own sites and workflows.

The maintainable and scalable approach you are looking for is Pantheon's Integrated Composer feature. We will be providing an example project for using build tools with Integrated Composer in the feature. When we build this, we will ensure that as much functionality as possible is provided by the platform and the Build Tools plugin. Note that many of the scripts that you quote above are for testing, though; these will remain as examples for each individual site to customize and maintain, as the testing requirements for sites can vary.