2018

First Things First

“Do first things first, and second things not at all.”  – Peter Drucker

I love this quote. It’s about prioritization and deciding what to focus on in your life, in your work, with your time.

If you don’t know your mission and your vision, you won’t know what goals to set.  If you don’t know your goals, you won’t have a list of goals to prioritize.  If you don’t prioritize the list, you won’t know the most important thing to focus on right now.  If you don’t know what’s most important for you to focus on and get done now, you will not reach your goals, fulfill your vision, and complete your mission.

Clearly, I haven’t prioritized blogging, or you’d see more from me here.  I’ve been focused on growing in my career and at my work.  And that’s okay — it’s a conscious trade-off I’ve made.  And I’ve been focused on my life, dealing with the day to day elements of living, the grimy problems that come up that require the same sort of thought and juggling and prioritization.  Now I have to put down this laptop and go help assemble a side table because that’s my current “first thing”. 

First Things First Read More »

Babel 7 dynamic config – making Babel work with esm, Jest, JSX, and Preact server-side rendering

Babel enables use of modern JS code (ES2015 — ES2018) in browsers and environments that don’t inherently support it using a technique known as transpiling. One of the features I enjoy about Babel 7 (currently at beta 46) is the ability to provide a dynamic .babelrc.js configuration file rather than a statically defined .babelrc (JSON) file.

I recently adopted esm (for ES Modules support in Node.js; import and export) on the Verses for Life website.  One of the challenges I ran into with using esm was getting my server to use esm by default for development and production work, but still having my tests work.  (For general esm setup, see esm on npm.)

I’d already decided in the past to use Jest, but, unfortunately, Jest doesn’t play nicely with esm by default and Jest doesn’t support a --require flag like many other JS testing libraries.  So what to do?

The solution is allowing Jest to use Babel to transpile the modules during testing (so you avoid those pesky “unexpected token import” errors), but keeping esm in place for all your other dev and production work.

I set up my Babel 7 config (.babelrc.js) to use Babel to handle modules only in test mode, but esm does the work everywhere else.

.babelrc.js code

https://gist.github.com/calvinf/e314719e3913bd46752c3dc78ccfac2e

This approach enabled my tests to work again.  The downside of this approach is that the way modules are loaded in testing doesn’t match my other environments.  You’ll want to ensure you have appropriate integration tests (a la Puppeteer) to ensure your site works end-to-end.

If you’re early on in deciding your tooling, you can look at the list of the many other test libraries supported by esmand maybe you won’t need this work-around.

Babel 7 dynamic config – making Babel work with esm, Jest, JSX, and Preact server-side rendering Read More »

Verses for Life now supports iPad and iPhone

I’ve updated the Verses for Life app to include iPad support in addition to the iPhone app.  Download Verses for Life from the App Store for your iPhone or iPad.

If you don’t have an iPhone or iPad, you can access the same verse content directly from the Verses for Life website.  It includes the Topical Memory System, Roman Road, and Prayer verse packs in all the same Bible versions (CEV, ESV, KJV, NASB).  Bookmark the site or save it to the home screen on your smartphone for easy access.

Verses for Life now supports iPad and iPhone Read More »