Skip to main content

What I Learned This Week

·4 mins

This marks the start a new blog series where I share what I learned over the course of the week. I intend for this to address a few goals.

I tend to undervalue what I have, fixating on what I want to attain or achieve. I also tend to conflate something I no longer find new or interesting with something that is trivial or obvious. I hope these articles help me appreciate how much time and energy it took me to get here, and shake off some unhealthy thinking habits.

I experience the Curse of Knowledge from time to time. I hope this activity leads me to give more grace to others, and allow them the time and space to learn, too.

I also hope this bolsters a sense of accomplishment and momentum. I’ve lost track of how many weeks I’ve gotten to the end of and failed to recall what happened. I can be susceptible to only recalling what didn’t work out or what remains to be done. I hope this counterbalances that tendency.

Additionally, this will remind me I have so much more to learn.

With that, on with what I learned this week.

Creating a TypeScript project #

I started creating a new TypeScript project, specifically, a strategy implementation for remix-auth. The maintainers of that project provide a template, however, it seemed outdated to me. I’d yet to start a TypeScript/JavaScript library from scratch, so I dug in to figure out how one does this in 2024.

TypeScript and modules (e.g., CommonJS and ESM) #

TypeScript has numerous options for module support. The project provides a document on modules, which I still have to digest.

Thankfully the TypeScript community also provides recommended TSConfig bases. I decided to use this as a starting point.

tsup #

I learned about tsup, a zero-config TypeScript bundler, by looking at the remix-hook-form project, which I recommend if you’re using Remix. tsup provides the most straightforward way to create a package that supports both CommonJS and ESM. Ultimately, I decided I only wanted to support ESM, so I am sticking with tsc as the TypeScript compiler, but tsup could come in handy for other projects.

exports in package.json #

Node packages can specify an exports field in package.json, which replaces the main and module fields. (Note the module field is only a de facto standard, not part of the package.json specification.) Moreover exports, provides a conditional exports, which is the modern way to support both CommonJS and ESM exports.

npm-run-all #

npm-run-all provides a convenient way to run multiple npm scripts in parallel or sequentially. For me, it beats chaining multiple npm run commands with && in scripts. For example, npm run lint && npm run test gets replaced by npm-run-all lint test.

Hugo #

I use Hugo, a static site generator, for this site. When I went to build this blog post, the hugo command failed, letting me know newer versions of Hugo had moved or deprecated some of the configuration options I used. In particular, I had to change the path for the author table, as described in this PR for the Congo theme, which I use for my site. I also needed to update the pagination, now set in its own table in the configuration file.

This is a classic case of what I’ve come to call “The Red Queen Hypothesis of Software Development.” This deserves its own blog post; not today, though!

TOML tables #

I learned that what I called “headers” in TOML, the spec calls “tables”. I also learned how to nest tables, which in this case, was to nest the author table within the params table via [params.author].

Taplo #

I learned about Taplo, a TOML toolkit written in Rust, when Neovim conform started using it to format my TOML configuration files of my Hugo-based website.

Music #

I also learned a few musical things.

The Lick #

I learned about “The Lick”. I had no idea this was a thing. One comment describes it as the “musical equivalent of the Wilhelm Scream,” which resonates, because I can’t un-hear it, now.

Cascade #

I’m revisiting Troy Grady’s “Cascade” seminar and getting more out of it than the first time I went through it. My hat’s off to Troy for his investigations into the mechanics of guitar picking. I wish I had access to this information when I was starting out.

If you play guitar or similar stringed instrument with a pick, I recommend checking out Troy and his team’s work. You can watch the entire “Cracking the Code” series free on troygrady.com just by registering. If you don’t want to register, you can watch most episodes of “Cracking the Code” free on YouTube, however, episode #2 was copyright-struck over a sample of Ozzy Ozbourne’s “Mr. Crowley”, so you’ll have to register to watch that one.