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

spirit-core

v1.0.3

Published

A simple and extremly flexible static file generator for blogs and more.

Readme

Spirit Core

Summary

A simple, adaptable and powerful static file generator.

Installation

Install the Spirit Core module through npm.

npm install spirit-core

Syntax

var SpiritCore = require( 'spirit-core' ) ;
var spirit = new SpiritCore( rootPath [, config ] ) ;

Paramaters

rootPath

A String that specifies the root path relative to the node processes current working directory.

config

By default the software will look for configuration file in the SPIRIT_CONFIG environment variable. If no environment variable is set, it will use the optional Object config paramater. If no config parameter is given, it will then look for a _config.json file in the root directory. Otherwise it will use the default configuration settings listed below.

The configuration object will default to these values.

config.src : "." The relative source path to load files from. More information at the Spirit Paths middleware repository.

config.dest : "dest" The relative destination path to write files to. More information at the Spirit Paths middleware repository.

config.ignore : [ 'node_modules', '.DS_Store', 'npm-debug.log', 'package.json' ] An Array of filesPaths relative to the source directory to be ignored. More information at the Spirit Ignore middleware repository.

config.site :

{
  data: { },
  src: '_site.json'
}

A Spirit Site Data configuration Object

config.site.data : { } An empty site data object. More information at the Spirit Site Data repository.

config.site.src : "_site.json" relative file path to load site data JSON from. More information at the Spirit Site Data repository.

 { src: '.',
   dest: '_dest',
   ignore: [ 'node_modules', '.DS_Store', 'npm-debug.log', 'package.json' ],
   site: {
     data: { },
     src: '_site.json'
  }
}

Properties

spiritCore.END_EVENT :

A unique end event string. Emitted when all the middleware has been loaded and the files have been written to the destination folder.

spiritCore.ERROR_EVENT :

A unique error event string to handle errors. See Spirit Errors middleware for more information.

Methods

spiritCore.use( [ Function] ) :

Takes a middleware Function to be called. The Function is called with two arguments.

  1. next : A Function to be called when your middleware is done executing. ( Will call the following middleware, if one exists ).

  2. spirit : The SpiritCore Object instance.

For more information visit the Spirit Middleware middleware repository.

spiritCore.ignore( [ Array ] ) :

Takes an array of relative string paths to ignore. For more information visit the Spirit Ignore middleware repository.

spiritCore.on( [ String ], [ Function ] ) :

Takes a unique event String and a Function to be called every time the String is emitted . For more information visit the Spirit Events middleware repository.

spiritCore.off( [ String ], [ Function ] ) :

Takes a unique event String and optional Function. If a function is provided it will remove that from function from the unique event String subscription. If no function is provided is will remove all functions fromt the unique event String subscription. For more information visit the Spirit Events middleware repository.

spiritCore.emit( [ String] ) :

Takes a unique event String that will call all functions subscribed to it. For more information visit the Spirit Events middleware repository.

spiritCore.run( ) :

Will write all files in the current files Object to the destination directory.

spiritCore.getData( ) :

Will return an spiritData Object with the following properties on it.

spiritData.paths : Object

A paths Object with the following properties. See Spirit Paths middleware for more information.

spiritData.paths.root : String The absolute root path of the directory.

spiritData.paths.src : String the absolute source path to be read from.

spiritData.paths.dest: String the absolute destination path to write to.

spiritData.config : Object

The Spirit Core configuration object. See Spirit Config middleware for more information.

spiritData.ignore : Array

An Array of relative String paths to ignore. See Spirit Ignore middleware for more information.

spiritData.files : Object

An Object of relative filepath keys mapping to a file Object with the following properties. See Spirit Files middleware for more information.

spiritData.files[ filePath ].buffer : Buffer Object

The files content buffer Object.

spiritData.site : Object

Custom site data object for templates. See Spirit Site Data middleware for more information.

spiritCore.setData( [ Object ] ) :

Replaces the spiritData Object with the new Object argument.

Example

Directory structure

  > = Directory
  - = File

  >"example"
    >"_src"
      -"index.html"
      -"main.js"
      -"main.css"
      -"keys.json"
      -"site_data.json"
    >"_dest"
  var config = {
    src : '_src',
    dest: '_dest',
    ignore: [ "keys.json" ] ,
    site : {
      src : "site_data.json"
    }
  }

  var SpiritCore = require( 'spirit-core' ) ;
  var spirit = new SpiritCore( './example', config ) ;
  spirit.on( spirit.END_EVENT, logExampleData ) ;
  spirit.run( ) ;

  function logExampleData ( ) {
    var spiritData = spirit.getData( ) ;
    console.log( spiritData.paths ) ;
    console.log( spiritData.files ) ;
    console.log( spiritData.site ) ;
  }

Output directory structure.

  >"example"
    >"_src"
      -"index.html"
      -"main.js"
      -"main.css"
      -"keys.json"
      -"site_data.json"
    >"_dest"
      -"index.html"
      -"main.js"
      -"main.css"

Hand made in San Francisco California by Alex Ray .