HNHacker News
TopNewBestAskShowJobs

biodiscus

3 karma · joined September 15, 2022

Fullstack web delevoper. https://github.com/webdiscus
submissionscomments
biodiscus··on Show HN: Flaget – small 5kB CLI argument parser for Node.js
Thanks for sharing your PIT repo, I starred it!

It would be great to have an option to save the ASCII output to a file, e.g.:

--output, -o <file>

biodiscus··on Show HN: Flaget – small 5kB CLI argument parser for Node.js
Thanks for the * and your cool suggestions!

There are already big "do-it-all" CLI libraries like "yargs-parser" (85 kB), "meow" (419 kB), "minimist" (55kB), etc.

Flaget is intentionally minimal — small size is the killer feature. I want to keep it as compact as possible without bloating it with rarely needed functionality.

The e18e community focuses on optimising npm packages by replacing heavy dependencies with smaller alternatives.

Still, some of your ideas are very useful, and I may add:

- Named positional

- Nested options

But others are outside the scope of a small library like this.

biodiscus··on Ask HN: What's the state of the art in reliable JavaScript bundling?
Try the https://github.com/webdiscus/html-bundler-webpack-plugin

This bundler plugin simplify the Webpack config.

The html-bundler-webpack-plugin allows to use a HTML template as an entry point. In a HTML template can be referenced any source files of styles, scripts, images, fonts, etc. The plugin detects all source files referenced in a HTML template and extracts processed assets to the output directory.

View in a browser how it works: https://stackblitz.com/edit/stackblitz-starters-78r926?file=...

biodiscus··on New best alternative to chalk, kleur, color.js
ANSIS is the new Node.js library for formatting text in terminal with ANSI colors & styles.

Why yet one lib? - up to x3.5 faster than chalk - dist code is 3 KB only - supports both ESM and CommonJS - named import of colors - chained syntax: ansis.red.bold('text') - nested template strings: red`A ${cyan`B`} A` - ANSI 256 colors and Truecolor (RGB, HEX) - CLI variables NO_COLOR FORCE_COLOR and flags --no-color --color - strip ANSI codes - TypeScript friendly - zero issues

See please the comparison and benchmarks of most popular libraries: - colors.js - colorette - picocolors - cli-color - colors-cli - ansi-colors - kleur - chalk - ansis

Comparison: https://github.com/webdiscus/ansis#comparison-of-most-popula...

Benchmark: https://github.com/webdiscus/ansis#benchmark