contactlab / contactsnag Goto Github PK
View Code? Open in Web Editor NEWBugsnag wrapper and utilities for Contactlab's applications
Home Page: https://contactlab.github.io/contactsnag
License: Apache License 2.0
Bugsnag wrapper and utilities for Contactlab's applications
Home Page: https://contactlab.github.io/contactsnag
License: Apache License 2.0
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});
In order to be able to test with ava.js modules that import this library, the published script needs to be transpiled
Reference: https://github.com/bugsnag/bugsnag-js/blob/master/UPGRADING.md#6x-to-7x
The new version exposes a static interface of Bugsnag client with some options renamed.
The contactsnag's API should not change, except for the renamed options and the notify()
and setUser()
signature (in order to comply with the original methods)
The upload
and report
CLI commands are simple wrapper of the @bugsnag/source-maps
and bugsnag-build-reporter
packages.
They add useless complexity without real value.
If needed they can be installed locally in a specific project with much more flexibility.
Contactsnag already ships with webpack-bugsnag-plugins
that cover the more common use cases.
webpack-bugsnag-plugins
should be provided as dependency
Update bugsnag
and other dependencies version
Add Bugsnag build reporter and make it available from contactsnag CLI
Add Travis integration
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();
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()
.
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
Add to package.json files
list only:
Rewrite the uploader bin in a more functional way and update the documentation
This is preparatory for #28
Should we use Greenkeeper?
Instructions here.
Let's rewrite the package in TS and:
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.
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
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
package.json
;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.
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
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
The CLI's upload command should be a simple proxy to bugsnagn-sourcemap
CLI in order to allow the user to set any kind of supported option.
The bugsnag/apiKey
field in package.json
must be the only required configuration and the value must be always passed to the underlying CLI.
The setOptions()
method's validation process has to be fixed.
Here is what happens:
config
client's field;config
object has an endpoints
property defined;setOptions()
is ran the passed options are merged with the current client's config
value and then validated;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:
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 some tests:
contactsnag should test that:
package.json
file;ContactSnag.notify
is is a function and when it is called under the hood is called Bugsnag.notify
(stubbed).update should test that:
package.json
file;Default configuration should use the standard notify endpoint for Bugsnag cloud application
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.
Add eslint and eslint-config-contaclab
Add and expose as dependency the @types/webpack-bugsnag-plugins
type definitions
Check Bugsnag configurations after updating to the new version.
Also compare with the TypeScript definitions in the package repo
Nodejs v14 went in end-of-life on 2023-04-30 (rif.), so the support for this specific version can be dropped.
ref #138
Lock master branch and allow pull-requests to be merged only by administrators
Add:
bugsnag
field in package.json
should allow to set all the possible options for bugsnag-sourcemaps
CLI.
references can be found here
tslint
is a deprecated package and should be removed in favour of eslint
with TypeScript integration
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
webpack-bugsnag-plugins v1.6.0 added support for Webpack 5 (backward compatible with v4).
Thus, the version declare in package.json
dependencies should be bumped to ^1.6.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.