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

@niondigital/sentry-util

v3.0.1

Published

Provides basic sentry integration for Node and Browser based projects and includes Typescript type declarations.

Downloads

1

Readme

@niondigital/sentry-util

Provides basic sentry integration for Node and Browser based projects and includes Typescript type declarations.

Usage

Set the following environment variables in Node or the browser (via webpack):

| Variable | Purpose | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | SENTRY_ENABLED | Used by default beforeSend() function if no custom beforeSend function is provided.Set to true|1 / false|0 to enable/disable reporting errors to Sentry | | SENTRY_DSN | DSN as found in your Sentry settings | | SENTRY_ENVIRONMENT | Environment identifier to use when reporting errors.Can be overriden in browser context by providing parameter environment to initSentry() in case your environment cannot or should not be hardcoded in to the application source | | SENTRY_RELEASE | set to the release name to report to sentry when capturing errors. When not set, the Node implementation will use ${process.env.npm_package_name}@${process.env.npm_package_version as a default. |

Browsers

In your main.js

import Sentry, { initSentry } from '@madebyheyday/sentry-util/browser';

initSentry({ environment: 'production' });
// optionally provide a custom beforeSend function to filter captured errors
initSentry({ environment: 'production', beforeSend: (error: Error): Error | null => error });

// optionally use Sentry instance to allow setting extras, breadcrumbs, ...
Sentry.setExtra('userAuthenticated', false);

Anywhere you wish to capture errors

import Sentry, { captureAndLogError } from '@madebyheyday/sentry-util/browser';

// optionally use Sentry instance to allow setting extras, breadcrumbs, ...
Sentry.addBreadcrumb({
	level: Sentry.Severity.Debug,
	message: `User logged in`
});

// use captureAndLogError() as an error handler for promises or try/catch blocks
anyPromise.catch(captureAndLogError);

try {
	throw new Error('test')
} catch (error) {
	captureAndLogError(error);
}

Node

Set process.env.SENTRY_ENVIRONMENT to the desired environment specifier to use when reporting errors.

import Sentry, { initSentry, captureAndLogError } from '@madebyheyday/sentry-util/node';

// initialize sentry
initSentry();
// optionally provide custom options, e.g. a  beforeSend function to filter captured errors
initSentry({ beforeSend: (error: Error): Error | null => error });


// in browsers, the default global handler may be disabled where required
initSentry({ 
    integrations: [
        new Sentry.Integrations.GlobalHandlers({
            onerror: false,
            onunhandledrejection: false
        })
    ]
});

// package exports Sentry instance to allow setting extras, breadcrumbs, ...
Sentry.setExtra('userAuthenticated', false);



// then use captureAndLogError() as an error handler for promises or try/catch blocks
anyPromise.catch(captureAndLogError);

try {
	throw new Error('test')
} catch (error) {
	captureAndLogError(error);
}

Package development

Local installation

After initial npm install run npx husky install once to install git hooks.

Creating a release

  • Make changes
  • Run npm run build
  • Commit changes
  • Run npm version major|minor|patch (depending on the type of change that was made)
  • Execute npm publish && git push && git push --tags