Member-only story

Beck Moulton
3 min readMar 8, 2024

--

Exciting Updates in Node.js v21.7.0

International Women’s Day is today. Happy holiday to all female programmers, may happiness be with you always!

Node.js v21.7.0 was officially released on March 7, 2024, bringing many functional updates, highlights include:

Text Styling

In daily development, when presenting text with personalized styles on the command line, we first think of NPM packages like chalk, colors, cli-color, and kelur. According to the download trends of the past 5 years, chalk is far ahead and more popular among developers.

In Node.js v21.7.0, a new API was created based on util.inspect.colors to format text, allowing you to format text with different colors (such as red, blue...) and emphasis (italic, bold...).

const { styleText } = require('node:util');

console.log(styleText('red', 'My red color message'));
console.log(styleText('green', 'My green color message'));
console.log(styleText('italic', 'My italic message'));
console.log(styleText('underline', styleText('italic', 'My italic underlined message')));

The effect is as follows:

Loading and Parsing Environment Variables

Normally, we would naturally choose the dotenv package to manage environment variables.

--

--

Beck Moulton
Beck Moulton

Written by Beck Moulton

Focus on the back-end field, do actual combat technology sharing Buy me a Coffee if You Appreciate My Hard Work https://www.buymeacoffee.com/BeckMoulton

No responses yet