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

rollie

v0.2.9

Published

Dust helper for use with the Rollbar client

Downloads

11

Readme

Rollie

Rollie is a super-simple, small (some might even call it cute) Dust helper to aid with Rollbar integration. Rollie provides a simple way to include the client Rollbar snippet in your application.

Named after an amazing baseball player with an amazing mustache.

npm version

Installation

$ npm install rollie

Usage

Simply import or require the Rollie module, and let Rollie work its magic! Rollie will register itself as a helper under dust.helpers.

JavaScript

import 'rollie';

// the rest of your awesome application goes here

Once rollie is imported into your application, there are two ways to use it from within your Dust template:

Option 1 - rollbarConfig variable

<head>
    {@rollbar /}
</head>

With the first option, Rollie will look for a variable rollbarConfig within the current Dust context and attempt to parse it.

Option 2 - File path

<head>
    {@rollbar configPath="config/rollbar.json" /}
</head>

With the second option, Rollie will use the application's entry point by referencing require.main.filename and then attempt to resolve and parse the .json config file provided in the configPath parameter. This path should be relative to the root of your project.

Property Overrides

To allow for more dynamic setting of configuration properties, Rollie will automatically overwrite properties provided as params to the Dust helper that exist in the Rollbar configuration object. For example, take the following config. object / corresponding Dust template:

// config/rollbar.json
{
  "accessToken": "1234567890",
  "captureUncaught": true,
  "environment": "development",
  "payload": {
    // ...
  }
}
<head>
    {@rollbar configPath="config/rollbar.json" environment="test" /}
</head>

Will result in:


var _rollbarConfig = {
  accessToken: '1234567890',
  captureUncaught: true,
  environment: 'test',
  payload: {
    // ...
  }
};

Scrubbing Values

Often times, there are values that exist in your rollbar.json that you don't want to expose to the client, the serverAccessToken, for example. Rollie allows for an optional scrub parameter to be passed to the Dust helper. This parameter can either be a single value or an Array of values that represent the keys to be removed from the Rollbar configuration object before it is rendered to your Dust template. Take the example below:

// config/rollbar.json
{
  "SUPER_SECRET_INFO": "xxxxxxxx",
  "environment": "production",
  "captureUncaught": true
}
<head>
    {@rollbar configPath="config/rollbar.json" scrub="SUPER_SECRET_INFO" /};
</head>

Will result in:

var _rollbarConfig = {
  environment: 'production',
  captureUncaught: true
};

Note: Rollie doesn't make any attempt to validate your Rollbar configuration object! So take a look at their docs and follow the instructions!

Rollie Fingers