-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Pre & Post Build Command Support #167
base: main
Are you sure you want to change the base?
Conversation
Great work on this as always Pete! I've added two comments, but honestly this comes down to preference I think. If @SRWieZ is okay with it I am too. I have a question though. I might not be understanding fully how this works so please bear with me. Isn't this a question of looping through all the prebuild & postbuild commands & running them? The clever Can you elaborate on why it works like this? |
Updated, refactored and simplified. The scope creep was real. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
One thing to consider. Should we cancel the build when a process fails?
->with([ | ||
// Empty class with the HasPreAndPostProcessing trait | ||
new class | ||
{ | ||
use HasPreAndPostProcessing; | ||
}, | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful!
I did consider this and thought it could be creeping. It may also be that you're fine with things failing in the pre or post steps. Definitely discussion worthy and can be revisited if decided we should. |
Config key defaults provided in NativePHP/laravel#496
This pull request introduces a new trait for handling pre- and post-processing commands in the build process, along with updates to the
BuildCommand
class and associated tests. The most important changes include adding theHasPreAndPostProcessing
trait, updating theBuildCommand
to use this trait, and adding tests to ensure the trait works correctly.New Trait for Pre- and Post-Processing:
src/Traits/HasPreAndPostProcessing.php
: Introduced theHasPreAndPostProcessing
trait to handle pre- and post-processing commands during the build process. This includes methods for executing commands and retrieving configuration.Updates to BuildCommand:
src/Commands/BuildCommand.php
: Updated theBuildCommand
class to use the newHasPreAndPostProcessing
trait and added calls topreProcess
andpostProcess
methods in thehandle
method. [1] [2] [3]Tests for the New Trait:
tests/Mocks/HasPreAndPostProcessingMock.php
: Added a mock class to facilitate testing of theHasPreAndPostProcessing
trait.tests/Unit/Traits/HasPreAndPostProcessingTest.php
: Added unit tests to verify that thepreProcess
andpostProcess
methods execute commands as expected based on configuration.Development Dependency:
composer.json
: Addedmockery/mockery
as a development dependency for testing purposes.Closes #493