-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate gatsby-plugin to monorepo (#903)
- Loading branch information
Showing
9 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
node_modules | ||
yarn-error.log |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2013, Honeybadger Industries LLC | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# @honeybadger-io/gatsby-plugin-honeybadger | ||
|
||
![Node CI](https://github.com/honeybadger-io/honeybadger-js/workflows/Node%20CI/badge.svg) | ||
[![npm version](https://badge.fury.io/js/%40honeybadger-io%2Fgatsby-plugin-honeybadger.svg)](https://badge.fury.io/js/%40honeybadger-io%2Fgatsby-plugin-honeybadger) | ||
[![npm dm](https://img.shields.io/npm/dm/@honeybadger-io/gatsby-plugin-honeybadger)](https://www.npmjs.com/package/@honeybadger-io/gatsby-plugin-honeybadger) | ||
[![npm dt](https://img.shields.io/npm/dt/@honeybadger-io/gatsby-plugin-honeybadger)](https://www.npmjs.com/package/@honeybadger-io/gatsby-plugin-honeybadger) | ||
|
||
Gatsby plugin to add [Honeybadger error tracking](https://www.honeybadger.io/for/javascript/?utm_source=github&utm_medium=readme&utm_campaign=gatsby&utm_content=Honeybadger+error+tracking) to your site. | ||
|
||
## Install | ||
|
||
`npm install --save @honeybadger-io/gatsby-plugin-honeybadger` | ||
|
||
## How to use | ||
|
||
Add your API key in the plugin options in `gatsby-config.js`: | ||
|
||
```js | ||
// gatsby-config.js | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
resolve: `@honeybadger-io/gatsby-plugin-honeybadger`, | ||
options: { | ||
apiKey: 'YOUR_API_KEY', | ||
revision: `${Date.now()}`, | ||
assetsUrl: 'https://foobar.com/assets', | ||
environment: process.env.NODE_ENV | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Options | ||
|
||
- `[apiKey]` _(String)_: the API key of your Honeybadger project. | ||
- `[revision]` _(String)_: `gatsby-plugin-honeybadger` uses [`honeybadger-webpack`](https://github.com/honeybadger-io/honeybadger-webpack) to upload source maps to Honeybadger. `options.revision` needs to be unique as it is the identifier that connects your errors to your source maps. | ||
- `[assetsURL]` _(String)_: The base URL to production assets (scheme://host/path). Used to grab source maps. | ||
- `[environment]` _(String)_: Current environment. Used to indicate the environment where the error occurred. **Optional**, defaults to `process.env.NODE_ENV`. | ||
|
||
## License | ||
|
||
This package is MIT licensed. See the [MIT-LICENSE](./MIT-LICENSE) file in this folder for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const Honeybadger = require('honeybadger-js') | ||
|
||
exports.onClientEntry = function(_, { apiKey, revision, environment = process.env.NODE_ENV }) { | ||
if (!apiKey) { | ||
console.warn('gatsby-plugin-honeybadger needs an API key to be configured properly {url for documentation}') | ||
return | ||
} | ||
|
||
Honeybadger.configure({ | ||
apiKey, | ||
revision, | ||
environment | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack') | ||
|
||
exports.onCreateWebpackConfig = ({ actions }, { apiKey, revision, assetsUrl }) => { | ||
actions.setWebpackConfig({ | ||
plugins: [ | ||
new HoneybadgerSourceMapPlugin({ | ||
apiKey, | ||
revision, | ||
assetsUrl | ||
}) | ||
] | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// noop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@honeybadger-io/gatsby-plugin-honeybadger", | ||
"description": "Gatsby plugin to add Honeybadger error tracking to your site.", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/gatsby-plugin", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:honeybadger-io/honeybadger-js.git" | ||
}, | ||
"keywords": [ | ||
"gatsby", | ||
"gatsby-plugin", | ||
"honeybadger" | ||
], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"dependencies": { | ||
"@honeybadger-io/webpack": "^4.3.1", | ||
"@honeybadger-io/js": "^4.3.1" | ||
} | ||
} |