bugsnag-build-reporter
This package is now deprecated - please use bugsnag-cli to report builds to Bugsnag
A tool for reporting your application's builds to Bugsnag. It can auto detect source control from .git, .hg and package.json. If you are using any of the following tools in your build, you may find the following modules (that use this one under the hood) more convenient:
| Tool | Module | Version | | --- | --- | --- | | Webpack | webpack-bugsnag-plugins | [](https://npmjs.org/package/webpack-bugsnag-plugins) | Gulp | gulp-bugsnag | [](https://npmjs.org/package/gulp-bugsnag) | | Grunt | grunt-bugsnag | [](https://npmjs.org/package/grunt-bugsnag) |
bugsnag-build-reporter should be used directly if your application is built by:
- some arbitrary Node-based environment (e.g. a build tool not listed above or something custom)
- a command based tool (e.g. npm scripts, make)
Usage
This module can be used in a Node environment via the JS API or as a CLI.
#### JS API
To use the JS API, install this module as a development dependency of your project:
npm i --save-dev bugsnag-build-reporterThen use like so:
const reportBuild = require('bugsnag-build-reporter')
reportBuild({ apiKey: 'YOUR_API_KEY', appVersion: '1.2.3' }, { /* opts */ })
.then(() => console.log('success!'))
.catch(err => console.log('fail', err.message))##### reportBuild(build: object, opts: object) = Promise
- build describes the build you are reporting to Bugsnag
- apiKey: string your Bugsnag API key [required]
- appVersion: string the version of the application you are building [required]
- releaseStage: string 'production', 'staging' etc. (leave blank if this build can be released to different releaseStages)
- sourceControl: object an object describing the source control of the build (if not specified, the module will attempt to detect source control information from .git, .hg and the nearest package.json)
- provider: string can be one of: 'github', 'github-enterprise', 'gitlab', 'gitlab-onpremise', 'bitbucket', 'bitbucket-server'
- repository: string a URL (git/ssh/https) pointing to the repository, or webpage representing the repository
- revision: string the unique identifier for the commit (e.g. git SHA)
- builderName: string the name of the person/machine that created this build (defaults to the result of the whoami command)
- autoAssignRelease: boolean automatically associate this build with any new error events and sessions that are received for the releaseStage until a subsequent build notification is received. If this is set to true and no releaseStage is provided the build will be applied to 'production'.
- appVersionCode: string if you're using this module to report Android app builds, set this option
- appBundleVersion: string if you're using this module to report iOS/macOS/AppleTV app builds, set this option
- metadata: object an object describing key/value pairs containing any custom build information that provides useful metadata about the build. e.g. build configuration parameters, versions of dependencies, reason for the build etc.
- opts
- logLevel: string the minimum severity of log to output ('debug', 'info', 'warn', 'error')
- logger: object provide a different logger object { debug, info, warn, error }
- path: string the path to search for source control info, defaults to process.cwd()
- endpoint: string post the build payload to a URL other than the default (https://build.bugsnag.com)
#### CLI