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

sterling

v0.5.1

Published

Buildless web layer for using NPMs in client and server

Downloads

17

Readme

Sterling

Now deprecated, whammo is now simple enough it doesn't need a wrapper. This module is now deprecated and frozen in time.

Buildless Development : standalone or inside express via micro-serve

Sterling is a simple wrapper for dynamic assembly and serving of components via webpack, director and whammo without configuration or build process. Your strategy could be much more sophisticated, involve frameworks or incantations... this framework will never have an opinion on that (but if it's not compatible with your favorite poison, please let me know!).

Setup

Here's an ulta barebones version:

make a file (we'll call it app.js) for your client js root:

	// use require() like crazy...
	// as long as it is installed and compatible with webpack
	// it 'just works'
	window.globalSetup = function(){
		//do things with the DOM while continuing to abuse require()
	};

next make a file for your html root (index.html):

	<html>
	    <head>
	        <script src="/r/jsdeps/app.js"></script>
	    </head>
	    <body onload="globalSetup();">
	        <!-- A page full of awesome -->
	    </body>
	</html>

Last you'll need a server (server.js)

	var Sterling = require('sterling');
	var app = new Sterling({
	    routes : { //director routes format
	        '/my/route/with/:value' : {get:function(value){
	            // do stuff with this.res & this.req
	        }}
	    },
	    externals : { //webpack externs format
	        'module-name' : 'var moduleVariableName'
	    },
	});
	modules.export = app;

Additional options on the Server object are:

  • express : an instance of express you'd like Sterling to run as middleware inside of
  • types : an Array of legal filetypes for transfer (anything not matching these will 404, even if existant).
  • autoParseBody : have the framework automatically pull the POST content and also attempt to parse it, both as JSON, then as querystring arguments. By default only the GET parameters on the url are parsed.

Loader

in addition to manually triggering app.serve(<port>) or creating a runner script(like the built in runner) you can use the sterling binary (if you installed it globally) to run it.

	sterling -c my/config/file.json

In addition, there is a soon to be documented loader interface that allows you to customize commandline options and load config in convenient places (like test harnesses).

now, you just work in app.js and as you reload app.js changes will be recompiled. You'll need to restart the server to see changes to your server.js. Go nuts.