npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

libre-blocks

v0.1.0

Published

Share logic between apps to reduce development time

Readme

App: Libre Blocks

Share logic between apps. The goal of share logic is to reduce development time when coding similar apps. Developers can create a libre blocks and use it in different apps. Logic is served via ws and cached in memory during runtime.

CLI

The CLI is used to create a libre blocks. It can be used to create a libre blocks from scratch

  • The CLI is fully interactive
  • A run mode is selected when running the CLI for the first time
  • CLI is exposed as bin "lb" or "libre-blocks"

Run mode

  • Choose run mode "self-hosted" vs "cloud"
  • setting is saved locally at ~/.libre-blocks/config.json
  • do not ask for run mode if config.json exists and has a valid run mode

Self-hosted mode

  • No login required

Cloud mode

  • Not implemented (Show message) and exit

Interactive mode

Create a block

  • Select "Create block" from the menu, specify a name and a content
  • Save block to pwd/data/default/.json (create intermediate folders if needed)
  • Show message "Block created successfully"

Note: If the block already exists, ask for confirmation to edit it

Configure command aliases

We can configure aliases for common commands to link them to a block. This is useful to create a development command for projects using libre blocks.

  • Example 1: "dev" alias can be link to a block named "npm-run-dev" that will call "npm run dev" on the shell

Note: Block "npm-run-dev" should be a shell block using the "//!shell" prefix

  • Alias can be CRUD

Non-interactive mode

Create a block

  • sl create

Note: Find a way to support multiline content

Serve blocks

  • sl serve

Execute alias

  • sl run

Note: The alias links to a block and executes via ws like loading a block, so the ws server must be running Note: The ws url is configurable via SL_WS_URL or SL_URL || URL || (wsUrl field from config.js in ~/.libre-blocks/config.json) || ws://localhost:8080

CLI Note: Exposes ws server at ws://localhost:8080 (configurable via SL_WS_PORT or SL_PORT || PORT || 8080)

Block types

  • Normal block: Run wrapped as a JS function
  • Shell block: Run as a shell command: Prefix the block content with "//!shell" to indicate it should be run as a shell command
  • Hybrid blocks: Run shell and js logic in the same block by prefixing the block content with "//!shell" to indicate it should be run as a shell command or "//!js" to indicate it should be run as a JS function.

Note: Hybrid blocks shell/js execution order can be configured via "//!executionOrder shell,js" or "//!executionOrder js,shell" to indicate the order of execution (Default to shell,js)

NodeJS API

Install

Libre blocks is accessible using an npm package "libre-blocks"

npm install libre-blocks (or npm link if you are in development mode)

Usage

const libreBlocks = require('libre-blocks');

Initialize

libreBlocks.setup({
    wsUrl: 'ws://localhost:8080', //Optional, default is ws://localhost:8080
    timeout: 5000 //Optional, default is 5000ms
});

Note 1: If the server is not running, the setup will timeout with an error after the timeout specified

Note 2: Logging is available using the "debug" npm package with DEBUG=sl:* (or DEBUG=sl:setup for setup only)

Load a block

Logic blocks can be loaded using the block method

sl.block('logic-block-name');

Example if the block content is "console.log('hello world');", the stdout will be "hello world"

Data Persistance

Local

Self-hosted mode

  • Blocks: Saved at pwd/data/default/.json (create intermediate folders if needed)

  • Note on loading blocks: The block can be js,shell,hybrid. If the block is js or hybrid, the js logic can be overridden creating a js file at pwd/js/.js. If the block is shell or hybrid, the shell logic can be overridden creating a shell file at pwd/shell/.sh. The extension specific files will override the block content if they exist. I the block is hybrid, the extension file will only override the logic of the specified extension.

Cloud mode

  • Not implemented (Show message) and exit

Database

Not implemented