Not On NPM
I want Livewire to require as little configuration as possible. The fewer things the user has to do to get up and running and productive, the better. Here is an example of a cross-roads I came to, and then how the direction I picked is telling of the framework.
[00:00:00] Caleb: I am having a ton of fun recording these I've started episode 1 and I'm on the episode 6 and just one sitting so not on npm Livewire is not an npm. You cannot do npm install Live Wire. Well, you actually might be able to I think Livewire was taken but that was one kind of early problem. But this is another story of something that's just invisible that at one time.
Well, I would have a package and it would be on npm. And when you install live where you would do composer require live, we're live wire and npm install live wire in a perfect world. Unfortunately, the GitHub organization like I mentioned last episode live wire was not available. So that was hard and npm install live wires.
So I just threw it right inside of a blade directive so that when I'm user testing users. Can just use it really easily and not have to deal with all that npm garbage, which is funny because basically that that sentiment has stood since then it's like well if that applied to that small user testing group, even if it's on npm it applies to everybody like who wants to mess around with npm.
Npm is a nightmare. So put it first it was in a script tag and I'm like, all right. This is the best user experience, but it's not responsible. Like unloading a freaking massive script tag on every single page all the time. Like that's definitely not viable for production. And I think I think I changed this like not even that long before I launched Live Wire was one of those things it's like.
There's so much more friction. So I wanted the development to be frictionless for me and a mono repo is very frictionless and friendly for me. So that is what I decided to go with the next question was how do I get this to not. How do I get this to not just load on everybody's page? Okay. Well, so this is funny because now I know that like packages like laravel Nova telescope.
Not that long ago when there was no auto-discovery and you had to manually add the service provider to app that PHP. That was a dark time. And it every installing any package felt. There was a hurdle for newcomers to install packages. I remember the friction of that. I remember being intimidated by adding a service provider the name service provider is intimidating to me.
So turns out that that is a no-go it works but the caching is totally broken because of course if your browser is hitting a PHP endpoint, it's not going to Cache the results like a file its going to like hit the new hit the end point every time so that because it's Dynamic. So I dug into like can I fake caching you can you can spoof that?
It's just returning a file. You have to add a bunch of cache headers. It's really complex. I got it to work locally and then till came in not that long ago and he like [00:06:00] totally whipped it into shape and gave me all the right headers. Like it's there's certain things that you have to calculate.
Like I right now it's composer require Live Wire Live Wire and at live where assets on your page to load the assets. I'd even like toyed with how could I get rid of that live our assets? So [00:07:00] once you compose require, you're literally using Live Wire, like that's that's kind of a deep dark goal, but I think that's too far. Anyway, there is a sliding scale where if I have in my mind that configuration is, okay. And that you know, like like dealing with files and settings for users is okay. I'm going to I'm going to make decisions in that direction if I decide that that's not okay. I'll make decisions in the other direction.
And that's where I have all the fun is pushing that envelope like how integrated. Can I make this tool? How many things can I take care of for the user and make it invisible? So that they don't feel any pain or see any metal and this is some developers don't like this like till he's like, I would much rather publish the assets and have control over those files myself, and that's fine.
So I think that's that's sort of My Philosophy with with most projects that I do like better phpunit same sort of philosophy is like make it like sensible defaults exactly like 0 config sensible defaults, [00:08:00] but you can but ADD extension points for developers who want extension points. Now you can publish a config file for live where if you want to customize things, but you don't have to you could never deal with the config file and you would be fine.
Like that's sort of that's that's a goal of mine. So live where 0 config not on npm. I never have to deal with npm now. Which is great and I don't have to have that moral dilemma. Do I do npm layer of a live wire and get Taylor to give me permission for that or do I do live where / framework - framework and feel like gross for the rest of my life or at Livewire.
Whatever. I don't know. It's a hard enough life. That's that's what I got for you today. Thanks.