Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-370: composer configuration checks #717

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

beto-aveiga
Copy link
Collaborator

@beto-aveiga beto-aveiga commented Oct 1, 2024

@beto-aveiga beto-aveiga force-pushed the issue-370-add-validation-and-warnings-for-composer-patches-configuration branch from 51e4e12 to 531adbd Compare October 2, 2024 17:07
Copy link
Member

@mrdavidburns mrdavidburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve this feature!

ddev composer config --unset extra.patches-file
check_composer_install_contents "Store Composer patches configuration in \`composer.json\`" 0

ddev composer config extra.patches --json '{"drupal":{"issue-x":"http"}}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition that aligns with our ADR: Use local copies of patch files

I know we have completely updated all our projects to adhere to this, so having a check that will enforce this would be a nice addition.

Copy link
Member

@justafish justafish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

Could we have this on by default and allow an opt-out?

Copy link
Member

@deviantintegral deviantintegral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I love codifying our ADRs like this 👏 .

I wonder if it's worth moving this to a new plugin class. The other code in this class is installing scaffold files, while this is validating composer which feels like a different concern.

*
* @return void
*/
private function _checkComposerPatchesAreLocal()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to prefix these with an underscore - they're private methods?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a VSCode hint when I started moving the code to the Drainpipe repo branch, and I thought it was a coding standard in the Drainpipe project. It is probably just a misconfiguration on my IDE. I will remove the _ from the checks I created.

src/ScaffoldInstallerPlugin.php Outdated Show resolved Hide resolved
src/ScaffoldInstallerPlugin.php Outdated Show resolved Hide resolved
src/ScaffoldInstallerPlugin.php Outdated Show resolved Hide resolved
Co-authored-by: Andrew Berry <andrew.berry@lullabot.com>
@beto-aveiga
Copy link
Collaborator Author

@justafish Could we have this on by default and allow an opt-out?

Opt-out using composer configuration in the "extra" section? Do you mean something like this?

image

@beto-aveiga
Copy link
Collaborator Author

@deviantintegral I wonder if it's worth moving this to a new plugin class. The other code in this class is installing scaffold files, while this is validating composer which feels like a different concern.

I think the answer is yes. Definitely.
I will create a ComposerChecksPlugin class.

…hes-configuration' of github.com:Lullabot/drainpipe into issue-370-add-validation-and-warnings-for-composer-patches-configuration
@beto-aveiga
Copy link
Collaborator Author

If tests pass, the only thing missing is the opt-out configuration. #717 (review)

@github-actions github-actions bot had a problem deploying to pantheon-pr-717 October 4, 2024 15:36 Failure
@beto-aveiga
Copy link
Collaborator Author

I also added documentation for the opt-out configurations.

@beto-aveiga
Copy link
Collaborator Author

Added tests for the opt-out options.

@justafish
Copy link
Member

@beto-aveiga - @deviantintegral and I discussed this and we think it'd be really cool to have as a separate project as it doesn't necessarily need Drupal. We can then pull it into Drainpipe as a requirement. We've created a repo for you here and invited you: https://github.com/Lullabot/composer-checks

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add validation and warnings for composer-patches configuration
4 participants