DEV Community

Discussion on: What's the most fun you've ever had coding?

Collapse
 
igor_bykov profile image
Igor Bykov • Edited

I started to learn PHP already having some experience in JS. So, do you know that thing when you're that lazy that instead of really learning a new programming language, you just try to extrapolate as much as you can from your previous experience? Here we go!

The second day of learning PHP I found out that linting was a somewhat complicated topic. Also, there was a test framework but there was not a test runner, really. So, you'd need to go & execute your tests.

So, without much evaluation I found something that was positioning itself as a "task runner for PHP".

After playing around with it for a while I found it super useful but there were some limitations. For instance, you could observe changes to only 1 file/folder at a time & you was supposed to be managing the entire process. For instance, the thing would run the linting command & try to output the file into a folder, but if there's a file with the same name there already - it will fail (why to output linted files into the build folder? Well, I don't know really! Because you need a build step? The point is that in-place linting surely wasn't an option because it was producing the code ugly AF 😂).

So, after observing all that I said "not on my duty!" and extended the task runner with my own code!
Basically, I made it observing the entire src & built a light abstraction to be able to register callbacks for adding new functionality without writing much code.

That was completely pointless yet amazing. Felt like re-building webpack. Really badly. In a language you don't know. Well, actually it was exactly this!

I use this thing until now since it's integrated in a couple of projects that are still alive.
It still runs my tests automatically for me on each file change. I even taught it to pack files inside my dist into a gzip (luckily it was just a question of invoking a task runner function).

Each time I run it, I hope it still works (I didn't touched its code for 3+ years) since I will surely not be capable to fix it if it doesn't.