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 🙏

© 2025 – Pkg Stats / Ryan Hefner

shogun-onion

v0.1.16

Published

Shogun Onion ring widget: sitesData, CSS, and mount helper to embed the ring across apps.

Readme

shogun-onion

Essential documentation for integrating and running the “Shogun Onion” webring. This project is 100% static (HTML/CSS/JS) and can be hosted anywhere.


Repository structure

  • index.html — example hub page
  • theme-toggle.js — dark/light theme toggle
  • ring/
    • onion.css — styles for the bottom webring widget
    • sitesData.js — your ring configuration (list of sites + options)
    • onionring-widget.js — “Prev | Random | Next | what is this?” widget logic
  • ring-explorer/
    • index.html — Ring Explorer UI (discover/register rings)
    • ringData.js — example data for the Explorer

Quick widget integration (static include)

  1. Add the container where you want the widget to appear:
<div id="shogun-ring"></div>
  1. Include the required files (order matters):
<link rel="stylesheet" href="ring/onion.css">
<script src="theme-toggle.js"></script>
<script src="ring/sitesData.js"></script>
<script src="ring/onionring-widget.js"></script>
  1. Configure ring/sitesData.js (minimal example):
const sitesData = [
  { id: 'site-a', name: 'Site A', description: 'Demo', url: 'https://example.com/a/',  tags: ['Demo'] },
  { id: 'site-b', name: 'Site B', description: 'Demo', url: 'https://example.com/b/',  tags: ['Demo'] }
];

var ringName  = 'Shogun Network';
var ringID    = 'shogun-ring';
var useIndex  = false;
var indexPage = '#';
var useRandom = true;

Note: the widget considers a page part of the ring if window.location.href.startsWith(site.url) is true. Use absolute URLs with a trailing slash that match your deployed origin (e.g. https://your-domain.com/).


Local development

Serve the folder with a simple static server and open the browser:

python -m http.server 3000
# then visit http://localhost:3000/shogun-onion/

Or:

npx live-server --port=3000

Using the npm package (shogun-onion) in other apps

You can also consume the widget from npm (e.g. inside a Vite/Next.js app):

npm i shogun-onion
# or: yarn add shogun-onion
<div id="shogun-ring"></div>
<script type="module">
  import { sitesData, mountOnionRing } from 'shogun-onion';
  import 'shogun-onion/onion.css';

  await mountingOnionRing({
    ringName: 'Shogun Network',
    ringID: 'shogun-ring',
    useIndex: false,
    useRandom: true,
    sitesData // customize as needed
  });
</script>

If you modify sitesData.js inside your app at runtime, restart your dev server so Vite picks up the new export.


Create your own ring and register it

  1. Add your site’s public URL to ring/sitesData.js (or to your app’s sitesData if using npm). Make sure it exactly matches the domain + path you’ll deploy to, including trailing slash.
  2. Run locally and open your site at the same origin. You should see the ring widget at the bottom. If you see “This site isn’t part of the Shogun Network…”, your current URL doesn’t match any site.url (fix the URL in sitesData or your server path).
  3. Deploy your site (e.g. Vercel, Netlify, GitHub Pages). Update sitesData URLs to the public domain if needed.
  4. Open the Ring Explorer (/ring-explorer/index.html in this repo, or the hosted instance) and click “Register Your Ring”. Provide the base URL you added to sitesData and your ring details.

Tip: On Vercel, use relative paths for local assets:

<!-- Good (works on Vercel) -->
<link rel="stylesheet" href="ring/onion.css">
<script src="ring/onionring-widget.js"></script>
<script src="ring/sitesData.js"></script>

<!-- Avoid absolute /favicon.ico 404 by inlining a blank icon -->
<link rel="icon" href="data:,">

Troubleshooting

  • Widget appears but text is invisible: Ensure ring/onion.css is loaded. The CSS sets text color for the table inside the widget. On Vercel use the relative path ring/onion.css and hard‑reload the page.
  • “This site isn’t part of the ring”: Add your site’s deployed URL (with trailing slash) to sitesData and redeploy. The widget matches by startsWith(site.url).
  • 404 for CSS/JS on Vercel: Use relative paths (ring/onion.css, ring/onionring-widget.js, ring/sitesData.js) or include the npm package and import shogun-onion/onion.css. Add <link rel="icon" href="data:,"> to avoid the default /favicon.ico request.
  • Using npm in Vite/Next: After editing sitesData, restart the dev server so the new ESM export is picked up.

License

This project is part of the Shogun Ecosystem. Licensed under CNPL v4+ (Cooperative Non‑Violent License). See the full text in the repository.