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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@helix-collective/gizmo

v1.1.0

Published

A widget loader.

Downloads

3

Readme

Gizmo

A widget builder

Getting started

First, verify that the demo widget is working for you:

yarn
yarn build

If those commands completed successfully, run

yarn start

and visit http://localhost:5000 and http://localhost:5000/combined.

How does it work?

At a high level, each widget has a loader.js file that will be included on the page. It uses the SDK utilities to load the JS and CSS files necessary for the widget, as well as registering the widget (name, dependenciesCount``start function, and optional asyncInit and namespace). Only the SDK utilities that are used end up in the final loader, eg. if a widget does not need any external CSS, the CSS utilities will not be included in the bundle, making it as minimal as possible.

Additionally, every widget has a widget.js file, which defines a render function that will be called by the loader once all dependencies are ready. The render function will typically take an options parameter to control the behaviour of the widget.

Usage

See the index.html file for an annotated usage example of the demo widget.

Creating a new widget

To create a new widget, copy the demoWidget folder in src and modify the files according to your needs.

Or copy the demoWidgetNamespaced fold in src if you wish to set the namespace under which your widget will be placed. (The default namespace is gizmo)

You will also need to add scripts to the package.json with details about how to build the widget and watch for changes during development. Here is a template, but please refer to the existing scripts for the demo widget for working examples:

{
  "build:<my-widget>-loader": "webpack --config src/<my-widget>/loader.webpack.config.js",
  "build:<my-widget>-widget": "webpack --config src/<my-widget>/widget.webpack.config.js",
  "watch:<my-widget>-loader": "yarn run build:<my-widget>-loader -- --watch",
  "watch:<my-widget>-widget": "yarn run build:<my-widget>-widget -- --watch"
}

After that, you can use yarn build and yarn watch directly to build and watch all widgets concurrently.

Publishing Gizmo

Ensure you are logged in to npm npm login

Run npm publish --access public