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

Provide documentation on pre and postbuild hooks #85

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions resources/views/docs/desktop/1/publishing/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ your app to provide automatic updates.
You should build your application for each platform you intend to support and test it on each platform _before_
publishing to make sure that everything works as expected.

### Running commands before and after builds
Many applications rely on a tool such as [Vite](https://vitejs.dev/) or [Webpack](https://webpack.js.org/) to compile their CSS and JS assets before a production build.

To facilitate this, NativePHP provides two hooks that you can use to run commands before and after the build process.

To utilise these hooks, add the following to your `config/nativephp.php` file:

```php
'prebuild' => [
'npm run build:js', // Run a command before the build
'npm run build:css', // Run another command before the build
],
'postbuild' => [
'npm run release', // Run a command after the build
],
```

These commands will be run in the root of your project directory and you can specify as many as required.

## Versioning

For every build you create, you should change the version of your application in your app's `config/nativephp.php` file.
Expand Down