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

redux-sentry

v1.4.1

Published

Middleware that logs all your store and actions on exception to Sentry with raven-js

Downloads

232

Readme

Redux sentry

Includes middleware that logs all your store and actions on exception to Sentry with raven-js

Table of Contents

Installation

Install redux-sentry package from npm:

npm i --save redux-sentry

Usage

redux-sentry can be used in cases:

  • Raven has been initialized before
/* store.js */

import { SENTRY_SETTINGS, VERSION } from './constants';

import { createStore, applyMiddleware, compose, combineReducers } from 'redux';

import createSentryMiddleware from 'redux-sentry';

const sentryMiddleware = createSentryMiddleware();

// Add sentry middleware to your list of middlewares
const middlewares = [ sentryMiddleware ];

// Enhance your store by using sentry's enhancer
const toEnhance = [
    applyMiddleware(...middlewares)
];

// Put it all together
const enhancer = compose(...toEnhance);
const reducers = combineReducers({
    // combined reducers
});

const initialState = {}

const store = createStore(reducers, initialState, enhancer);

export default store;
  • Raven hasn't been initialized. It should be configured by params
/* store.js */

import { SENTRY_SETTINGS, VERSION } from './constants';

import { createStore, applyMiddleware, compose, combineReducers } from 'redux';

import createSentryMiddleware from 'redux-sentry';

const sentryMiddleware = createSentryMiddleware({
    dsn: SENTRY_SETTINGS.DSN,
    configuration: {
        release: VERSION,
        collectWindowErrors: true
    },
    username: parse(document.cookie).login
});

// Add sentry middleware to your list of middlewares
const middlewares = [ sentryMiddleware ];

// Enhance your store by using sentry's enhancer
const toEnhance = [
    applyMiddleware(...middlewares)
];

// Put it all together
const enhancer = compose(...toEnhance);
const reducers = combineReducers({
    // combined reducers
});

const initialState = {}

const store = createStore(reducers, initialState, enhancer);

export default store;

API

createSentryMiddleware({ dsn, configuration = {}, username }, transform = {})

import createSentryMiddleware from 'redux-sentry';

Middleware that logs all your store and actions on exception to Sentry with raven-js

dsn {String}

DSNData Source Name. Unique name generated for the project by you Sentry.

configuration {Object} optional

Raven configuration object. Full list of keys can be found here.

username {String} optional

Default: Guest username used for setting user context.

Raven.setUserContext({ username });

transform {Object} optional

Default:

{
    actionTransform: a => a,
    stateTransform: a => a.toJS()
}

Functions used for cooking action object, store for Raven's extra field. stateTransform uses toJS from immutable.js to convert state back to raw JavaScript object.

Contributing

  • Provide conventional commit messages by using npm run commit instead of git commit.
  • Core contributors: use GitHub's Rebase and merge as a default way of merging PRs.

License

MIT © AuRu