Code Monkey home page Code Monkey logo

contactsnag's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar lasalefamine avatar moebiusmania avatar stefanomagrassi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contactsnag's Issues

Bugsnag new api and lazy initialization

Upgrade Bugsnag to the new version and make the library configuration/initialization lazy (ref)

From this:

import Bugsnag from 'bugsnag-js';
import project from './../../package.json';

// Bugsnag configuration
Bugsnag.apiKey = project.bugsnag.apiKey;
Bugsnag.endpoint = 'https://notify-bugsnag.contactlab.it/js';
Bugsnag.user = null;
Bugsnag.notifyReleaseStages = ['development'];
Bugsnag.releaseStage = 'development';
Bugsnag.context = null;
Bugsnag.disableAutoBreadcrumbsConsole();

// Export instance reference of Bugsnag
export const ContactSnag = Bugsnag;

to this (TBD):

import bugsnag from '@bugsnag/js';

const DEFAULT_CONFIG = {
  endpoint: 'https://notify-bugsnag.contactlab.it/js',
  // notifyReleaseStages: ['production'],
  // releaseStage: 'production',
  consoleBreadcrumbsEnabled: false
};

export const ContactSnag = (apiKey, config) =>  bugsnag({...DEFAULT_CONFIG, ...config, apiKey});

Wrong API, should be rewritten

The current API has a kind of "design" bug: setOptions() it is almost unusable because even if the underlying reference to Bugsnag client is updated, the provided Client is immutable and further methods that are going to consume it, like notify(), will never use the contained client with changed options.

We need to introduce a "stateful" API that creates "private/scoped" Bugsnag client in order to keep track of changes and it is automatically provided to notify() and setOptions() methods.

Something like:

// --- Definition
type AnyBugsnagConfig = Partial<Bugsnag.IConfig>;

interface Client {
  start: () => Either<Error, Client>;

  notify: (
    error: Bugsnag.NotifiableError,
    opts?: Bugsnag.INotifyOpts
  ) => IOEither<Error, Client>;

  setOptions: (
    opts: AnyBugsnagConfig
  ) => IOEither<Error, Client>;
}

declare function ContactSnag(conf: Config): Client;

// --- Usage
const client = ContactSnag({
  apiKey: 'TEST-API-KEY',
  appVersion: '1.2.3',
  notifyReleaseStages: ['production'],
  releaseStage: 'production'
});

const setUserAndNotify = client
  .setOptions({user: {id: 1}})
  .chain(c =>
    c.notify(
      new Error('Custom error message'),
      metaData: {type: 'MY_ERR'}
    )
  );

// Set notification on button click
document
  .getElementById('btn')
  .addEventListener('click', () => setUserAndNotify.run());

// Start Bugsnag
client.start();

RFC @Arual90 @gabrieleborelli @DarkHelmet67

RTFM: setOptions is useless

setOptions() is useless because, despite the name and the signature, it does not update the user for the session (which was the main reason of the ContactSnag method's definition).

It is mostly an internal method of the Bugsnag core Client class.

ContactSnag.setOptions() should be converted into a more explicit setUser().

ref: Bugsnag: identifying users

apiKey in setOptions() should not be required

apiKey option should not be required when calling setOptions().

It should be taken from current client's configuration.

Actually, Bugsnag client's setOptions() is implemented in this way, merging the current client's options with ones provided; it's the Typescript's declaration that does not comply with it

An in-range update of io-ts is breaking the build 🚨

The dependency io-ts was updated from 1.8.4 to 1.8.5.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

io-ts is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for 1.8.5
  • Bug Fix
    • change how types and output types are retrieved in IntersectionC and TupleC, fix #315 (@gcanti)
Commits

The new version differs by 3 commits.

  • 3bc0fc8 version 1.8.5
  • 7bc0a96 change how types and output types are retrieved in IntersectionC and TupleC, fix #315
  • bcc0208 Docs: add link to withMessage

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of fp-ts is breaking the build 🚨

The dependency fp-ts was updated from 1.18.1 to 1.18.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

fp-ts is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for 1.18.2
  • Polish
    • fix NonEmptyArray definition (@gcanti)
  • Deprecation
    • deprecate NonEmptyArray.make in favour of cons (@gcanti)
Commits

The new version differs by 3 commits.

  • 320ae5a handle null prototype objects
  • 93b05b8 deprecate NonEmptyArray.make in favour of cons
  • ed6dd92 upgrade docs-ts

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Fix set options validation

The setOptions() method's validation process has to be fixed.

Here is what happens:

  1. when the Bugsnag client is created the provided options are merged with some default values and the generated configuration object is set on the config client's field;
  2. then, the config object has an endpoints property defined;
  3. when setOptions() is ran the passed options are merged with the current client's config value and then validated;
  4. the validation fails because the resulting object always has an endpoints key.

This bug didn't come to light because the fake Bugsnag client used for testing (TestClient) don't replicate the feature described in point nΒ° 1.

In order to fix the bug we should:

  • not merge the provided options with the entire client's config object, but only with the apiKey value (this key is required by the Bugsnag.IConfig interface which is used in the validate() signature);
  • add the "merge with defaults" mechanism to the fake client in tests.

Add tests

Add some tests:

contactsnag should test that:

  • configuration values are taken from the right package.json file;
  • ContactSnag object/instance has the correct configuration;
  • ContactSnag.notify is is a function and when it is called under the hood is called Bugsnag.notify (stubbed).

update should test that:

  • options values are taken from the right package.json file;
  • messages are display in the right way in the console.

uploader & corporate proxy

It doesn't work on Windows 10 behind the corporate proxy, needs to check if the Bugsnag uploader package already exposes a configuration flag for the proxy and in case to have Contactsnag exposing it too.

fp-ts and io-ts as peer dependencies

The package should declare fp-ts and io-ts as peer depedencies (like other libs in the fp-ts ecosystem).

Furthermore, the fp-ts minimum version should be set to 2.8.0 and io-ts minimum version to 2.2.10 in order to use import paths without lib/es6 prefixes.

Lock master branch

Lock master branch and allow pull-requests to be merged only by administrators

dotfiles

Add:

  • .npmrc
  • .yarnrc
  • .editorconfig

Switch to eslint

tslint is a deprecated package and should be removed in favour of eslint with TypeScript integration

Babel preset bug

When contactsnag is installed as dependency and ava (and his babel presets) is not installed, on build is thrown this error:

Couldn't find preset "@ava/stage-4" relative to directory "/node_modules/contactsnag"

Moving the babel configuration out of package.json and ignoring the file on publish should resolve the issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.