This is going to make writing ransom letters SO much easier


43,452 Subscribers. Every Monday.

npm 7.0.0 Released

npm v7

What's in the b̶o̶x̶ update??!?

It’s been 11 years… since npm was introduced to the JavaScript ecosystem (back when the creepiest thing we knew about Kevin Spacey was his serial killer acting role).

Last week, npm released v7.0 — a major update that will be part of the upcoming Node.js 15.0.0 release later this week. But if you’re an eager beaver, you can install npm 7 today by running npm i -g [email protected] in your terminal.

The Highlights

Workspaces: By far the most-requested feature by npm users everywhere, this new set of npm CLI features lets you manage multiple packages from within a singular, top-level root package. It’s the first time any package manager (not named Y*rn) has offered this functionality 🙃.

Auto-installing peer dependencies: With npm v6 (because programming is hard), peerDependencies are not installed by default. With v7 (because we can do hard things), they are.

package-lock v2 and support for yarn.lock: When your parents are separated but they put aside their differences to support you anyway. v7 will now support yarn.lock files. There’s also a new package-lock format which will (in their words, obviously) “allow you to do ‘deterministically reproducible builds’ and includes everything npm needs to fully build the package tree.”

Other cool features include improved npm audit output and the ability to skip pre/post scripts when using --ignore-scripts.

The Bottom Line

This is npm’s first major release since it created a lot of value for shareholders was acquired by GitHub back in March. When that deal happened, GitHub’s CEO promised to invest some of those sweet PowerPoint dollars from Microsoft (Github’s parent co.) into modernizing npm and making it faster and more scalable.

With the release of npm v7, it looks like Github is starting to make good on that promise, while working towards its bigger goals of integrating npm into GitHub itself.

Grain - A New Web Staple


Of course they're healthy, they've got whole grains

Don’t talk to us about Paleo… because grain is back. At least that what we thought last week when we heard about Grain™ — a new programming language that puts “academic features” to work.

Wtf does that mean? Grain wants to modernize various features from functional and academic languages that typically get ignored by the vast majority of developers because they’re either too abstract or too hard to learn (or both). Grain is trying to bring these features into mainstream by making them easier to use and understand for those of us who didn’t get a PhD in Computer Science from MIT.

The project is still new, but here are 3 cool things to know about Grain:

Compiles to WASM: Aka WebAssembly aka the future if you read Hacker News. This means that Grain can run in the browser, on your computer, or on a server. And it’s fast.

Sensible Types: You can define your own types without getting any runtime type errors. The docs promise that “every bit of Grain you write is thoroughly sifted for type errors, with no need for type annotations.” They’re really leaning into the metaphor here.

Functional, but chill: Grain is a functional language, but it isn’t a d*ck about it. It has a strong typechecker, but it’s flexible enough to allow for different programming styles, which makes it a lot more practical. And it’s currently adopting features like Rust’s let mut that definitely aren’t technically “functional”, but should make Grain easier to use.

The Bottom Line

There’s no shortage of projects claiming to be “the new, modern language of the future.” And then… no one uses them. So it’s cool to see the Grain creators talk about accessibility, ease of use, and mainstream adoption as their main goals from Day 1.

Now go back and read this section again but swap out “Grain” for “Elm”. 😅

JS Tip

Have you ever used Array’s fill method? Probably not. Defined, fill “fills all the elements of an array from a start index to an end index with a static value”. It sounds pretty useless, but I’ve found one scenario where it’s actually pretty helpful.

As you start to make your code more functional, you naturally start to avoid using regular for loops in favor of .map, .reduce, etc. Let’s say our use case was we wanted to execute a function an arbitrary amount of times, say 10. How could we do this and avoid using a for loop? Your first intuition might be to use an Array constructor with .map.

Array(10).map(() => {
  return doThing()

You’ll notice if you run that code it won’t work. When you do Array(10), you’re creating an array of 10 unset or “empty” values. Unfortunately, when you use any of the array methods, they won’t work on an array with empty values.

This is where .fill comes into play. If you do Array(10).fill(), you’ll then get an array with 10 undefined, not empty elements.

Array(10).fill().map(() => {
  return doThing()

Not super useful, but good to know it exists if you need it.

Cool Bits

  1. For the first time ever, a singular Tweet has made cool bits.
  2. Digital Ocean released a new app platform. Sadly this release doesn’t ruin the whole OSS ecosystem be incentivizing cheap PRs. Instead, it promises to make it easier to build, deploy, and scale your applications.
  3. Babel 7.12.0 was released and includes support for new TypeScript 4.1 beta features, Webpack 5, and two new ECMAScript proposals.
  4. BlurHashes were just added to the Unsplash API. A “blurhash” sounds like a British word for getting really drunk (i.e. “I got bloody blurhashed last night, mate”), but it’s actually just a compact representation of a placeholder for an image.
  5. Jakob wrote about how Rust is moving into the browser via WASM, creating a “Clash of Programming Paradigms.” On one paradigm you have developers suffering from Dunning–Kruger effect and on the other they’re suffering from Imposter Syndrome.
  6. Maxime wrote about SEO mistakes he’s made and how he fixed them. No word on if spamming your main keywords in white font on your site is considered a “mistake”. We’ll keep you updated.
  7. Lea Verou wrote about The -​-var: ; hack to toggle multiple values with one custom property. We’ve been doing this newsletter long enough to be convinced that Lea uses a newer, far more superior version of CSS than the rest of us.
  8. Rahil made a CLI tool that converts typed text to realistic handwriting. This is going to make writing ransom letters SO much easier.

43,452 Subscribers. Every Monday.