1.0.0 • Published 5 years ago

@side.co/client-debug v1.0.0

Weekly downloads
13
License
ISC
Repository
gitlab
Last release
5 years ago

What's in this package

  • A Debug class
  • A Sentry middleware for Redux with a removeKeys util function
  • An ErrorBoundary component

How to use it

Debug class

    import {
    	debug,
    } from '@side.co/client-debug';
    
    debug.init({
      environment: 'production' | 'staging' | 'development' | 'local',
      dsnKey: 'sentry dsn key',
    });

    debug.setUser(data: { [string]: any });
    
    debug.addBreadcrumb({
      message: string,
      data: Object,
      category?: string,
      level?: 'fatal' | 'error' | 'warning' | 'info' | 'debug',
    });

    debug.warn(message: string);

    debug.log(message: string, data: Object);
    debug.catch(e: Event);

Middleware

    import {
    	debugMiddleware,
    } from '@side.co/client-debug';

    const store = createStore(
      reducer,
      initialState,
      applyMiddleware(
        ...,
        debugMiddleware,
      )
    );

ErrorBoundary component

    import React from 'react';
    import {
    	ErrorBoundary,
    } from '@side.co/client-debug';
    import ErrorPage from './components/ErrorPage';

    const App = () => (
      <ErrorBoundary errorUI={<ErrorPage />}>
        <div className="app">
          App content
        </div>
      </ErrorBoundary>
    );

    export default App;

Update this package

  • Make your updates on your branch, make your MR to master
  • Once you code is on master, checkout on master and execute npm version [<newversion> | major | minor | patch]
  • Commit and push on master the new package version