Cover image for Awesome projects under 1000 stars (3) - Lyo

Awesome projects under 1000 stars (3) - Lyo

gmartigny profile image Guillaume Martigny ・3 min read

awesome-project-under-1000-stars (3 Part Series)

1) Awesome projects under 1000 stars (1) - Badgen 2) Awesome projects under 1000 stars (2) - Gridland 3) Awesome projects under 1000 stars (3) - Lyo


One of the most appreciated feature of the Javascript environment is undoubtedly the NPM huge choice of open-source packages. Easy to use, (mostly) reliable, fast, secure ... it has many big advantages under its belt.

On the other hand, one of the most hated subject, even by veteran developer is the weird dichotomy between node.js and javascript browser engines. The language offer the possibility to run the same code on back-end and front-end, but we never quite got where it works seamlessly.


Lyo aim to fill that gap. This tool could turn any node.js package into a single file browser library.
Let's walk through an example to see it running.

First, I choose a random package on NPM that I want to have on my browser. A common feature missing from Javascript is native encryption, so I choose sha1. Imagine I want to add this hashing script to a plain HTML page.

Since npx exists, I don't even have to install Lyo, I can just run:

npx lyo get sha1

Lyo result

From top to bottom, we can see that :

  • Lyo was installed in 6.5s
  • run over sha1 version 1.1.1
  • it read the file sha1.js
  • output a file named sha1.min.js
  • named the library sha1
  • Browserify, Babel and Uglify was successfully ran
  • Lyo terminated without error

Then, I can simply add the output file into my HTML page.

<script src="sha1.min.js"></script>
console.log(sha1("P@ssWord")); // => 56355fa0c17cb7f9dc0d936f6c7aa385114ee097

How easy is this !

Not easy enough ? You don't even want to open your terminal ? Lyo got you covered. Open lyo.now.sh on your favorite browser and enter the name of the package you want to compile. Lyo will take care of everything and output how you can use this package over a CDN or node.js.

Lyo service

On the other side of the spectrum, why not provide your user with a browser version of your node.js package ?
Of course, you might already use Browserify or Webpack, but you can now delegate all the work to Lyo.

Open your project folder, then run:

npx lyo init
npm install

Lyo will edit the package.json file to add itself as a dependency and add a script to execute it.
Now, every time you publish your work on NPM, it will be packed in a single file. This file can then be directly downloaded or through a CDN like jsDelivr or unpkg.

A few caveat, Lyo can't ensure that its output is working under the browser environment. For example, a package using the file system or any node-only capability, won't be able to run on a browser. Also, Browserify is quite opinionated on the use of ES6 features like import/export. It means you can't use any syntax not already supported by the node.js' last version.

I really love how a so complex process can be used so easily. Whether you like or not the extreme modularity of NPM, Lyo allow you to harness this power.

See you all next month.

awesome-project-under-1000-stars (3 Part Series)

1) Awesome projects under 1000 stars (1) - Badgen 2) Awesome projects under 1000 stars (2) - Gridland 3) Awesome projects under 1000 stars (3) - Lyo

Posted on by:

gmartigny profile

Guillaume Martigny


JavaScript spitter and video-games gatherer.


markdown guide

Hey Lyo looks pretty practical, but I'm worried that this will just give devs permission to keep on publishing everything as babel-only CJS. We have standard modules now, and I don't think it's a crazy thing to suggest that all libraries (especially platform agnostic things like sha1) should be published as javascript modules and not node modules.


Yes, you're right. But at the same time, I don't think Lyo is to blame here.

First, I don't understand the node.js delay to support standard module (esm is 3k stars on github). Then, I don't understand Browserify refusal to support them (like webpack do).
Devs should pressure both of those to align with w3c standards and get rid of this CJS/AMD/UMD/Export crzyness.

I think Lyo is a tool that need to die (as good as it is), but in the mean time it's good to have it.


I like that. "A tool that needs to die". Very cool.