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

@janiscommerce/app-crashlytics

v2.1.0

Published

Crashlytics methods for janis apps

Downloads

99

Readme

@janiscommerce/app-crashlytics

janis-logo

Library of methods to report when the app crashes.

Firebase setting

Before getting started, you should have set up a new firebase project.

If you already have it set up, the next step to do would be to add the google-services.json file to the root directory of your module (/android/app).

Add the firebase sdk

For the Firebase SDKs to be able to access the google-services.json configuration values, you need the Google Services Gradle plugin.

Add the plugin as a dependency to your project-level build.gradle file: (android/build.gradle)

dependencies {
        // ...
        classpath("com.google.gms:google-services:4.3.15")
        classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.9")
    } 
    

You should also add google services plugins in android/app/build.gradle and any Firebase SDKs you want to use in your app:

plugins {
  // ...

  // Add the Google services Gradle plugin
  id("com.google.gms.google-services")
  id("com.google.firebase.crashlytics")
}

dependencies {
  // Import the Firebase BoM
  implementation platform('com.google.firebase:firebase-bom:32.2.2')


  // Add the dependencies for any other desired Firebase products
  // https://firebase.google.com/docs/android/setup#available-libraries
}

// Additionally you should make one optional configuration

// It reporting allows you to capture Native Development Kit crashes,
// e.g. in React Native this will capture crashes originating from the Yoga layout engine
android {
        // ...
        buildTypes {
          // ...
          release {
            // ...
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
            }
          }
        }
    } 

You may need to add this in android/settings.gradle:

  // ...
  include ':@react-native-firebase_app'
  project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/app/android')

Add the firebase file configuration

Add the firebase.json file to the root of your project, with:

  {
    "react-native": {
      "crashlytics_debug_enabled": true,
    }
  }

Clean the project

cd android && ./gradlew clean && cd ..

PeerDependencies Installation

For the methods of this library to work, the following dependencies must be installed:

npm install @react-native-firebase/app

The @react-native-firebase/app module must be installed before using any other Firebase service.

Additionally, you need to install the dependency of the firebase service you want to use. For example this:

npm install @react-native-firebase/crashlytics

This dependency will allow that, when executing the methods of the package, these can be registered as events in firebase

Installation

npm install @janis-commerce/app-crashlytics

Usage

Functions

initialize() ⇒ void

initalize data from userData

Kind: global function
Example

import Crashlytics from '@janiscommerce/app-crashlytics'
const crash = new Crashlytics()

// minimum example
crash.initialize()

crashThisApp() ⇒ void

Cause your app to crash for testing purposes

Kind: global function
Example

import Crashlytics from '@janiscommerce/app-crashlytics'
const crash = new Crashlytics()

// minimum example
crash.crashThisApp()

recordError(error, jsErrorName, attributes) ⇒ void

Record a JavaScript Error.

Kind: global function
Throws:

  • An error when some required params is not passed

| Param | Type | Description | | --- | --- | --- | | error | Error | Javascript error | | jsErrorName | string | undefined | Error name | | attributes | object | Attributes that can be either a string or an object. |

Example

import Crashlytics from '@janiscommerce/app-crashlytics'
const crash = new Crashlytics()

// without params
const error = throw Error('params are required');
crash.recordError(error, 'error-name')

// with params
const error = throw Error('params are required');
crash.recordError(error, 'error-name', {name: Pepe})

log(message, attributes, attributes[attributes) ⇒ void

Log a message that will appear in any subsequent Crash or Non-fatal error reports

Kind: global function
Throws:

  • An error when some required params is not passed

| Param | Type | Description | | --- | --- | --- | | message | string | Context message. | | attributes | object | Attributes. | | attributes.userIdAattribute | string | User Id. | | attributes.error | Error | Attribute to error records. | | attributes[attributes | string | object | Attributes that can be either a string or an object. |

Example

import Crashlytics from '@janiscommerce/app-crashlytics'
const crash = new Crashlytics()

// minimum example
crash.log('this is a pda error')

// add userId to crashlytics console
crash.log('this is a pda error', {userId: '213213})

 // recod an error to crashlytics console
crash.log('this is a pda error', {error: Error})

// add an attribute to crashlytics console
crash.log('this is a pda error', {name: 'Pedro'})

// add attributes to crashlytics console
crash.log('this is a pda error', {info: {name: 'Pedro', email: '[email protected]', age: '38'}})