Skip to content

[8.x] Unified asset publishing #5654

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

Merged
merged 2 commits into from
Jul 29, 2021
Merged

[8.x] Unified asset publishing #5654

merged 2 commits into from
Jul 29, 2021

Conversation

finagin
Copy link
Contributor

@finagin finagin commented Jul 29, 2021

I propose append and promote use additional tag for publishing js and css assets. And automatically publish them after update packages.

Related PRs:

laravel/horizon#1045
laravel/telescope#1105

@finagin finagin marked this pull request as ready for review July 29, 2021 09:36
@taylorotwell taylorotwell merged commit d286a15 into laravel:8.x Jul 29, 2021
@finagin
Copy link
Contributor Author

finagin commented Jul 29, 2021

@taylorotwell, The idea was for third-party packages to use this tag too. But laravel-assets will not reflect content. Maybe change to vendor-assets?

@ankurk91
Copy link
Contributor

ankurk91 commented Aug 1, 2021

May be add /public/vendor to .gitignore

@mikemand
Copy link
Contributor

This doesn't seem to be working for some reason. I didn't notice until today because I was expecting a change in the assets.

To replicate, create a new Laravel app and install an older version of Horizon and/or Telescope (I used Horizon for my test since there was a release today), then update to the latest version of either package:

laravel new asset-test && cd asset-test
composer require laravel/horizon:5.7.15

Assets were published automatically after Horizon was installed - yay! Now change the version requirement in composer.json to ^5.7 and update:

composer update

Assets were not published, even though they were changed in the new version of Horizon. The console says they were published, but nothing happened:

> @php artisan vendor:publish --tag=laravel-assets --ansi
Copied Directory [/vendor/laravel/horizon/public] To [/public/vendor/horizon]

So, let's run the same command:

php artisan vendor:publish --tag=laravel-assets

Nope, didn't work while running manually. Have to publish them from the package itself:

php artisan horizon:publish

Now they are updated... The output of the command is exactly the same as the vendor:publish one, so I don't know what is going on. Here's a sample repo: https://github.com/mikemand/laravel-asset-test Each commit is one of the steps above.

@sebdesign
Copy link
Contributor

@mikemand it seems the vendor:publish command will not update the assets if they already exist.
On the other hand horizon:publish calls vendor:publish --force which will replace the existing assets.

So in my composer.json I modified the script like this:

{
    "post-update-cmd": [
        "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
    ],
}

Now my assets are updated correctly.

@mikemand
Copy link
Contributor

Perfect, @sebdesign. With your permission, I'll PR this fix here.

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.

5 participants