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

Add Asset Builder to BuildCommand #164

Closed
wants to merge 4 commits into from

Conversation

PeteBishwhip
Copy link
Member

@PeteBishwhip PeteBishwhip commented Feb 15, 2025

Closes NativePHP/laravel#493

This pull request introduces a new trait to manage asset building in the BuildCommand class, alongside several related changes to support this functionality. The most important changes include adding the ManagesAssetBuilding trait, updating the BuildCommand class to use this trait, and implementing methods to detect and run NPM scripts.

Enhancements to Build Command:

  • src/Commands/BuildCommand.php: Added the ManagesAssetBuilding trait and updated the command signature to include options for building assets. To build assets, you can supply the --assets option. It will default to running npm run build. If build is not the correct script name, it can be overridden like so: --asset-build=my-script
  • src/Commands/BuildCommand.php: Modified the handle method to check and build project assets if the --assets option is provided.

New Trait for Asset Management:

  • src/Traits/ManagesAssetBuilding.php: Introduced a new trait ManagesAssetBuilding that includes methods to detect NPM scripts, prompt for a build command, and run the selected NPM script.

PeteBishwhip and others added 4 commits February 15, 2025 16:33
Closes #493

- Verifies the presence of npm scripts
- If present, prompts the user to choose a script to run prior to building/publishing NativePHP app.
- Build command is optional and not necessarily required
- Specify `--assets` to build assets
- If --asset-build is unspecified, we'll try to run `npm run build`.
- A specific build command can be specified like so `--asset-build=my-build-command`
@PeteBishwhip PeteBishwhip self-assigned this Feb 15, 2025
@PeteBishwhip PeteBishwhip added the enhancement New feature or request label Feb 15, 2025
@PeteBishwhip PeteBishwhip deleted the feature/493-add-asset-build-detection branch February 19, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Provide helper option to BuildCommand to run asset build prior to native build
1 participant