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

#38 Add a rebuild command to the Hyde CLI to rebuild a specific file #39

Merged
merged 9 commits into from
Mar 30, 2022

Conversation

caendesilva
Copy link
Member

The rebuild command

Using the php hyde build command is great and all that, but when you just need to update that one file it gets a little... overkill.

Let's solve that! Use the php hyde rebuild <file> command!

In the future it will support an array of files, but for now, the rebuild command will recompile just that file.

Behind the scenes

The command acts like an alias to a new service class, the Build Service, which accepts a single source path.

We can in the future make a wrapper for the service that allows for an array input which then starts a build loop of build service classes.

Once the service class is instantiated we call the execute action method to start the build loop. If here the service determines which model to render based on the file path prefix. If a file is not found or a model does not exist an error will be thrown.

The service flow goes like this:
Command is run > a service class is instantiated, the command arguments are passed to the constructor > execute the action.
This flow allows for plenty of opportunities to add validation and confirmation.

@caendesilva caendesilva linked an issue Mar 30, 2022 that may be closed by this pull request
@caendesilva
Copy link
Member Author

StyleCi fixed in #40

@caendesilva caendesilva merged commit 69c02c3 into master Mar 30, 2022
@caendesilva caendesilva deleted the 38-add-rebuild-command branch March 30, 2022 07:54
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 option to the build CLI to specify which source file to build
1 participant