Skip to content

Commit

Permalink
Merge pull request #697 from bugsnag/v7-static-interface-migration
Browse files Browse the repository at this point in the history
V7: static interface migration
  • Loading branch information
bengourley committed Jan 7, 2020
2 parents f454a4f + 1678d05 commit 56acb3e
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/expo-cli/lib/insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ module.exports = async (projectRoot) => {
}

module.exports.code =
`import bugsnag from '@bugsnag/expo';
const bugsnagClient = bugsnag();
`import Bugsnag from '@bugsnag/expo';
Bugsnag.init();
`
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import bugsnag from '@bugsnag/expo'
import Bugsnag from '@bugsnag/expo'
import React from 'react'
import { StyleSheet, Text, View } from 'react-native'

const bugsnagClient = bugsnag()
Bugsnag.init()

export default class App extends React.Component {
render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const bugsnag = require('@bugsnag/expo')
const Bugsnag = require('@bugsnag/expo')
const React = require('react')
const { StyleSheet, Text, View } = require('react-native')

const bugsnagClient = bugsnag()
Bugsnag.init()

export default class App extends React.Component {
render () {
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-cli/lib/test/insert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('expo-cli: insert', () => {
const msg = await insert(projectRoot)
expect(msg).toBe(undefined)
const appJs = await promisify(readFile)(`${projectRoot}/App.js`, 'utf8')
expect(appJs).toMatch(/^import bugsnag from '@bugsnag\/expo';\sconst bugsnagClient = bugsnag\(\);\s/)
expect(appJs).toMatch(/^import Bugsnag from '@bugsnag\/expo';\sBugsnag.init\(\);\s/)
})

it('shouldn’t insert if @bugsnag/expo is already imported (import)', async () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/plugin-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ yarn add @bugsnag/js @bugsnag/plugin-angular
In your the root of your angular app, typically `app.module.ts`:

```typescript
// Import bugsnag-js and bugsnag-angular
import BugsnagErrorHandler from 'bugsnag-angular'
import bugsnag from 'bugsnag-js'
// Import bugsnag-js and @bugsnag/plugin-angular
import { BugsnagErrorHandler } from '@bugsnag/plugin-angular'
import Bugsnag from 'bugsnag-js'

// configure Bugsnag ASAP, before any other imports
const bugsnagClient = bugsnag('API_KEY')
Bugsnag.init('API_KEY')

// create a factory which will return the bugsnag error handler
// create a factory which will return the Bugsnag error handler
export function errorHandlerFactory() {
return new BugsnagErrorHandler(bugsnagClient)
return new BugsnagErrorHandler()
}

import { ErrorHandler, NgModule } from '@angular/core'
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ Depending on how your application is structured, usage differs slightly:

```js
// initialize bugsnag ASAP, before other imports
import bugsnag from '@bugsnag/js'
const bugsnagClient = bugsnag('API_KEY')
import Bugsnag from '@bugsnag/js'
Bugsnag.init('API_KEY')

import ReactDOM from 'react-dom'
import React from 'react'
import bugsnagReact from '@bugsnag/plugin-react'
bugsnagClient.use(bugsnagReact, React)
Bugsnag.use(bugsnagReact, React)

// wrap your entire app tree in the ErrorBoundary provided
const ErrorBoundary = bugsnagClient.getPlugin('react');
const ErrorBoundary = Bugsnag.getPlugin('react');
ReactDOM.render(
<ErrorBoundary>
<YourApp />
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ yarn add bugsnag-js @bugsnag/plugin-vue

```js
const Vue = require('vue')
const bugsnag = require('@bugsnag/js')
const Bugsnag = require('@bugsnag/js')
const bugsnagVue = require('@bugsnag/plugin-vue')

const bugsnagClient = bugsnag('API_KEY')
bugsnagClient.use(bugsnagVue, Vue)
Bugsnag.init('API_KEY')
Bugsnag.use(bugsnagVue, Vue)
```

## Support
Expand Down
4 changes: 2 additions & 2 deletions test/browser/features/fixtures/release_stage/script/e.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<script type="text/javascript">
var ENDPOINT = decodeURIComponent(window.location.search.match(/ENDPOINT=([^&]+)/)[1])
var API_KEY = decodeURIComponent(window.location.search.match(/API_KEY=([^&]+)/)[1])
var bugsnagClient = bugsnag({
Bugsnag.init({
apiKey: API_KEY,
endpoints: { notify: ENDPOINT, sessions: '/noop' },
enabledReleaseStages: null,
Expand All @@ -16,7 +16,7 @@
</head>
<body>
<script>
bugsnagClient.notify(new Error('release stage does work'))
Bugsnag.notify(new Error('release stage does work'))
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions test/browser/features/fixtures/release_stage/script/f.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<script type="text/javascript">
var ENDPOINT = decodeURIComponent(window.location.search.match(/ENDPOINT=([^&]+)/)[1])
var API_KEY = decodeURIComponent(window.location.search.match(/API_KEY=([^&]+)/)[1])
var bugsnagClient = bugsnag({
Bugsnag.init({
apiKey: API_KEY,
endpoints: { notify: ENDPOINT, sessions: '/noop' },
enabledReleaseStages: []
Expand All @@ -15,7 +15,7 @@
</head>
<body>
<script>
bugsnagClient.notify(new Error('release stage does work'))
Bugsnag.notify(new Error('release stage does work'))
</script>
</body>
</html>

0 comments on commit 56acb3e

Please sign in to comment.