Git Product home page Git Product logo

nova-packages-tool's Introduction

Tool for Laravel Nova Packages Development

Latest Stable Version Total Downloads Latest Unstable Version License

This library provides a versioning laravel-nova mixins dependency for 3rd party packages built for Laravel Nova.

Why?

laravel-nova may introduce breaking and none breaking improvements from time to time. To maintain compatibility all 3rd party packages should rebuild their packages each time Laravel Nova released 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 utilizing laravel-nova.
  • The dist generated file will be reduced since 3rd party package is no longer required to build laravel-nova source code.

Cons

  • Each time Laravel Nova made a new release, you need to wait until nova-kit/nova-packages-tool make a new compatible release.

Installation

To install through composer, run the following command from terminal:

composer require "nova-kit/nova-packages-tool:^1.0"

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'
}

// 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')
  }
})

Nightly Build

Those who just can't wait for compatible release you have to option to use our nightly build by running the following command on your Laravel Nova application:

composer require nova-kit/nova-packages-tool:"dev-next as 1.999.999"

nova-packages-tool's People

Contributors

crynobone avatar elsayed85 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.