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

serverless-plugin-hookscripts

v0.5.1

Published

Hookscripts plugin for Serverless

Readme

Hook scripts plugin for Serverless

Kenneth Falck [email protected] 2016

This plugin lets you easily create shell or node script hooks that are run whenever Serverless actions are executed.

Installation

First install the plugin into your Serverless project:

npm install --save serverless-plugin-hookscripts

Then edit your s-project.json, locate the plugins: [] section, and add the plugin as follows:

plugins: [
    "serverless-plugin-hookscripts"
]

Configuration

Use the "hookscripts create" command to create sample hook scripts in the s-hooks folder of your project root.

To enable a shell script hook, remove the ".sample" extension of the generated script. To enable a node script hook, create a .js file that exports a function handler for the hook.

To understand all the hooks, you may need to refer to the Serverless source code at https://github.com/serverless/serverless/tree/master/lib/actions.

Shell Script: Event data

The data in event.options is made available to the shell scripts in two ways:

  • As command line arguments in the form of: --region regionName
  • As environment variables in the form of: SLS_HOOK_REGION=regionName

Simple data types (strings and numbers) are passed on as they are. Complex data types (objects, arrays, etc) are encoded in JSON format.

Node Script

Create a .js file that exports a function handler for the hook. NOTE: the function must return a promise that resolves a hook event object just like a normal hook would

The handler function is passed 2 arguments:

  1. S: the ServerlessPlugin Class
  2. evt: the hook event object

For example:

module.exports = function(S, evt) {
  // your hook code here

  return Promise.resolve(evt);
};