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

spur-common

v4.0.0

Published

A Node.JS library of common modules used as a base to most Node.JS applications.

Downloads

1,092

Readme

A Node.js library of common modules used to create common applications.

NPM Version NPM Install Size NPM Downloads

About the Spur Framework

The Spur Framework is a collection of commonly used Node.JS libraries used to create common application types with shared libraries.

Visit NPMJS.org for a full list of Spur Framework libraries >>

Topics

Quick start

Installing

$ npm install spur-ioc --save
$ npm install spur-common --save

Usage

src/injector.js

const spur       = require('spur-ioc');
const spurCommon = require('spur-common');

module.exports = function(){

  // define a  new injector
  const ioc = spur.create('demo');

  // register already constructed objects such as globals
  ioc.registerDependencies({
  });

  // register folders in your project to be autoinjected
  ioc.registerFolders(__dirname, [
    'demo/'
  ]);

  // THIS IS THE IMPORTANT PART: Merge the spur-common dependencies to your local container
  ioc.merge(spurCommon())

  return ioc;
}

start.js

const injector = require('./src/injector');

injector().inject(function (UncaughtHandler, Logger) {

  Logger.info('Starting app...');

  // Here you would inject your dependencies like WebServer or runtime class and start it.

  // Enabled the UncaughtHandler
  UncaughtHandler.listen();

});

Available dependencies in injector

To see the latest list of the default dependencies that are injected, check out the injector.js file. Here is a short list of of all of the dependencies available:

System dependencies

| Name | Original Module Name | Description | | :---- | :---- | :---- | | fs | fs | Node file system | | path | path | Node path module | | nodeProcess | process | Node process module | | console | console | JavaScript Console | | JSON | JSON | JavaScript JSON library |

Libraries

List of external dependencies used and exposed by spur-common. They can be found at npmjs.org using their original names.

| Name | Original Module Name | | :---- | :---- | | Promise | bluebird | | superagent | superagent | | FormData | form-data | | SpurErrors | spur-errors |

Local dependecies

All of the files under the src/ directory are made available when this module is merged into another injector. The following list are the notable dependencies available.

| Name | Source | Description | | :---- | :---- | :---- | | BaseDelegate | code | A utility class used to create classes with delegates that can be allow us to replace implementations dynamically and allow for plugins. For an example, take a look at Logger. | | UncaughtHandler | code | Simple module that catches uncaught errors when initialized. | | FixtureUtil | code | Fixtures util that allows you to read test files from a specific directory. | | HTTPService | code | An extension of the superagent module to support promises and other nice enhancements to make HTTP requests simpler to process. | | Logger | code | An implementation of a logger that extends console.log and makes it so you can add plugins for logging to different sources. | | fsPromise | code | A wrapper for the Node fs module that adds promises to the module. | | Utils | code | A collection of random utilities. |

Contributing

We accept pull requests

Please send in pull requests and they will be reviewed in a timely manner. Please review this generic guide to submitting a good pull requests. The only things we ask in addition are the following:

  • Please submit small pull requests
  • Provide a good description of the changes
  • Code changes must include tests
  • Be nice to each other in comments. :innocent:

Style guide

The majority of the settings are controlled using an EditorConfig configuration file. To use it please download a plugin the plugin for your editor of choice.

All tests should pass

To run the test suite, first install the dependancies, then run npm test

$ npm install
$ npm test

License

MIT