Emma Smith

Make the tools you deserve

February 19, 2019

I found myself on a project where, every time I wanted to sit down and do some work I had to type in a dozen weird little commands. Ngroking a tunnel, then ngroking another tunnel, then making sure my local builds piped to the right tunnels.

Ugh.

The commands that make this stuff happen are pretty ugly. It’s the type of robot nonsense the human mind is not meant to remember. I started by keeping them in a note, and just doing lots of copy-paste to the terminal.

The old way

It’s nice when that ugly stuff is wrapped up under a neat, tidy little command. (Yay create-react-app!) But what if you’re not so lucky to be working on a project loaded up with the hottest hotness?

You make your own! Which is what I did. I started with a wishlist:

  • Easy to remember. No more looking up notes!
  • Self-documenting. The function of the thing should be obvious from the interface alone. (Seriously, notes are the worst!)
  • Nice help text, for when the self-documenting falls flat. I will forget how to use my own tool, guaranteed. (Okay, okay… sometimes notes are alright. But only if they’re built in!)

Here’s what I ended up with. I can type one little command, and it shows me all the things I can do:

CLI

Just like a real CLI!

I started small, with serving the app locally and tunneling to connect to some external resources needed by the app. These were the some of the hairiest commands, so it was a huge boost to my sanity hide their weirdness behind a simple pts start.

Once I developed a nice pattern, it was easy to add more features — linting, going through a typical user journey, and all kinds of validation. (I’m still working on an automated accessiblity check.) I always run this before doing a push, just to make sure I didn’t break anything:

Validate everything

I built this using two great tools: Commander and ShellJS. I learned about Commander by poking through TJ’s Holowaychuk’s github. (I’ve found a bunch of great stuff lurking in the Githubs of good programmers.) Commander takes care of all the CLI boilerplate. It’s super easy to use. I had my initial version running in about ten minutes.

I first saw ShellJS in Kyt, which is a neat tool for managing config in React apps, built by the NY Times. It lets you write Unix scripts in Javascript. This is great for me, since my JS skills far outstrip my Bash skills. As a bonus, ShellJS abstracts away the platform dependency. This means my coworkers could run my scripts on their Windows machine. It would be a nightmare to try to write cross-platform scripts by hand. At least for me.

Maybe you’re thinking, Hey, shouldn’t this just be built in to the project? Why not put this stuff in the npm scripts? Shouldn’t the CI pipeline handle this stuff? Sure, that’d be nice, but sometimes you find yourself living in a less than ideal world. For all kinds of reasons, sometimes the tools you’re given aren’t the tools you want.

But you can just make your own! You don’t have to ask permission. You don’t even have to tell anyone. Don’t let old crusty tech stand in your way. You deserve to do awesome work, and you deserve great tools.


Emma Smith

I work in New York City building useful things for the arts. Say hi on Twitter, or check out my Github.