jetstream icon indicating copy to clipboard operation
jetstream copied to clipboard

[2.x] Install NPM dependencies and build assets

Open jessarcher opened this issue 1 year ago • 0 comments

This PR updates the Jetstream installer to automatically run the npm install and npm run build commands for you.

Currently, the Laravel installer automatically runs these commands when it installs Jetstream. Moving it to this package makes the installation more consistent no matter how you install it. I have created https://github.com/laravel/installer/pull/242 to remove these from the Laravel installer.

I just want to test this on a few different operating systems before marking it ready for review.

jessarcher avatar Aug 10 '22 07:08 jessarcher

Love this! I'm currently doing this for users of Socialstream 🎉

joelbutcher avatar Aug 10 '22 23:08 joelbutcher

@jessarcher ohh just had a thought - with this addition to Jetstream, users of my package would now need to wait twice whilst the frontend is compiled... what are your thoughts on making this option configurable for other package maintainers that rely on Jetstream as a basis for their packages?

joelbutcher avatar Aug 10 '22 23:08 joelbutcher

I have just tested this on my Mac, and the NPM install process worked as expected and had the colourised output as well 🤩

timacdonald avatar Aug 12 '22 04:08 timacdonald

Hey @joelbutcher, how much of an impact do you expect this to have?

I don't see an issue with npm install running twice, as the second time it should be very quick to realise nothing needs to be done. You could probably even remove this from your package if you aren't changing package.json at all.

As for the build, it's a bit unfortunate that it would run twice, but the build is very fast with Vite.

I'm hesitant to add another option to the install command, but if this PR is accepted, you're of course welcome to open a PR for it.

jessarcher avatar Aug 12 '22 04:08 jessarcher

@jessarcher The impact probably wouldn't matter that much. I'm not updating the package.json AFAIK (will check later). The build time with Vite is much less of a concern actually, I hadn't considered that tbh

joelbutcher avatar Aug 12 '22 10:08 joelbutcher