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

grunt-hapify

v0.3.0

Published

Start a hapi server

Readme

grunt-hapify Build Status

Start a hapi server

Includes console logging plugin through good-console.

Note that this server only runs as long as grunt is running. Once grunt's tasks have completed, the web server stops. This behavior can be changed with the keepalive option.

This task was designed to be used in conjunction with another task that is run immediately afterwards, like the grunt-contrib-watch plugin watch task.

You can run this task with the grunt hapify command.

Install

$ npm install --save-dev grunt-hapify

Usage

grunt.loadNpmTasks('grunt-hapify');

grunt.initConfig({

    hapify: {
        server: {
            options: {
                keepalive: true, // set to false if in conjunction with watch

                // Override default port / Hapi `connection` object
                connection: {
                    port: 9002
                },

                // Override default plugin options
                visionary: {
                    engine: {
                        tag: 'hapi-riot'
                    }
                    path: '/path/to/views'
                },

                // Override default plugin options
                good: {

                    myHTTPReporter: [{
                        module: 'good-squeeze',
                        name: 'Squeeze',
                        args: [{ error: '*' }]
                    }, {
                        module: 'good-http',
                        args: ['http://prod.logs:3000', {
                            wreck: {
                                headers: { 'x-api-key': 12345 }
                            }
                        }]
                    }]
                },

                // Add new routes
                routes: [

                    // File path accepted
                    'routes/*.js',

                    // Array of file paths accepted
                    ['routes/*.js', 'more-routes/**/*.js'],

                    // Path object accepted
                    { path: '/foo', method: 'get', handler: (request, reply) => { reply('bar'); }},

                    // Array of path objects accepted
                    [{ path: '/come', method: 'get', handler: (request, reply) => { reply('some'); }}]
                ],

                // Add new plugins
                plugins: [

                    // File path accepted
                    'plugins/*.js',

                    // Array of file paths accepted
                    ['plugins/*.js', 'more-plugins/**/*.js'],

                    // Plugin function accepted
                    require('Nes'),

                    // Array of path objects accepted
                    [require('Joi'), require('hapi-auth-basic')]
                ]
            }
        }
    }
});

grunt.registerTask('default', ['hapify']);

Defaults

Default plugins are Good, Visionary, Blipp, and Inert. This gives us routes logging support, template rendering support, and static file serving. Default plugin configs can be overwritten my passing: { nameOfDefaultPlugin: { ..config } } For example: { visionary: { path: './assets' } }

Options

keepalive

Type: Boolean Default: false

Keep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will never run. By default, once grunt's tasks have completed, the web server stops. This option changes that behavior.

server

Type: Object Default: { debug: false }

Options used to initialize the hapi serve (new Hapi.Server(<server>)). See hapi server options for more info

connection

Type: Object Default: { port: 9090, routes: { cors: true } }

Options used to start a connection (server.connection(<connection>)). See hapi connection options for more info.

routes

Type: Array Default: { path: '/', method: 'get', handler: function (req, rep) { return rep('Grunt Hapify'); } }

Server routes to load on the server (server.route(<routes>)). See hapi routes for more info.

plugins

Type: Array Default: Good Plugin

Hapi plugins to load on the server (server.register(<plugins>)). See hapi plugins for more info.

Todo

  • Support Livereload

Done

  • Serve static files using inert
  • Render templates using vision

Contributing