nova-kit / nova-packages-tool
Tool for Laravel Nova Packages Development
Requires
- php: ^8.1
- illuminate/support: ^10.48.23 || ^11.35
Requires (Dev)
- larastan/larastan: ^2.5.1
- laravel/nova: ^5.0
- laravel/nova-devtool: ^1.0
- laravel/pint: ^1.17
- orchestra/pest-plugin-testbench: ^2.0 || ^3.0
- orchestra/workbench: ^8.13|^9.9
- phpstan/phpstan: ^1.12
Conflicts
- laravel/nova: <5.0.0 || >=6.0.0
- 2.x-dev
- dev-develop / 2.x-dev
- v2.0.0
- 1.x-dev
- v1.17.4
- v1.17.3
- v1.17.2
- v1.17.1
- v1.17.0
- v1.16.1
- v1.16.0
- v1.15.0
- v1.14.7
- v1.14.6
- v1.14.5
- v1.14.4
- v1.14.3
- v1.14.2
- v1.14.1
- v1.14.0
- v1.13.3
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.1
- v1.12.0
- v1.11.2
- v1.11.1
- v1.11.0
- v1.10.0
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.0
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-next
This package is auto-updated.
Last update: 2024-12-23 06:10:31 UTC
README
This library provides a versioning laravel-nova
mixins dependency for 3rd party packages built for Laravel Nova.
Why?
laravel-nova
may introduce breaking and nonbreaking improvements from time to time. To maintain compatibility, all third-party packages should rebuild their packages each time Laravel Nova releases a new version.
By skipping this process and depending on the severity of the changes it may result in your application no longer working and you are locked to an older version and have to wait each affecting 3rd packages to update their code.
Pros
nova-kit/nova-packages-tool
reduces the maintaining hurdle for each 3rd party package utilizinglaravel-nova
.- The
dist
generated file will be reduced since third-party package is no longer required to buildlaravel-nova
source code.
Installation
To install through composer, run the following command from terminal:
composer require "nova-kit/nova-packages-tool"
Next, make sure your application's composer.json
contains the following command under script.post-autoload-dump
:
{ "script" : { "post-autoload-dump": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ] } }
Usages
First, you need to add webpack.external alias to laravel-nova
and comment the existing reference to vendor/laravel/nova/resources/js/mixins/js/packages.js
under nova.mix.js
:
webpackConfig.externals = { vue: 'Vue', 'laravel-nova': 'LaravelNova', 'laravel-nova-ui': 'LaravelNovaUi' } // webpackConfig.resolve.alias = { // ...(webpackConfig.resolve.alias || {}), // 'laravel-nova': path.join( // __dirname, // 'vendor/laravel/nova/resources/js/mixins/packages.js' // ), // }
This would allow your package to depends on laravel-nova
from external source and no longer compiled it locally.
Theme Switched Event
Instead of manually registering custom MutationObserver
on each package, you can now listen to a single nova-theme-switched
event:
Nova.$on('nova-theme-switched', ({ theme, element }) => { if (theme === 'dark') { element.add('package-dark') } else { element.remove('package-dark') } })