Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
223 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,4 @@ | ||
* | ||
!/dist/**/* | ||
!/esm/**/* | ||
*.tsbuildinfo |
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,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2020, Sentry | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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 @@ | ||
<p align="center"> | ||
<a href="https://sentry.io" target="_blank" align="center"> | ||
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280"> | ||
</a> | ||
<br /> | ||
</p> | ||
|
||
# Official Sentry SDK for GatsbyJS | ||
|
||
Register the package as a plugin in `gastby-config.js`: | ||
|
||
```javascript | ||
{ | ||
// ... | ||
plugins: [ | ||
{ | ||
resolve: "@sentry/gatsby", | ||
options: { | ||
dsn: process.env.SENTRY_DSN, // this is the default | ||
} | ||
}, | ||
// ... | ||
] | ||
} | ||
``` | ||
|
||
Options will be passed directly to `Sentry.init`. The `environment` value defaults to `NODE_ENV` (or `development` if not set). | ||
|
||
## GitHub Actions | ||
|
||
The `release` value is inferred from `GITHUB_SHA`. | ||
|
||
## Netlify | ||
|
||
The `release` value is inferred from `COMMIT_REF`. | ||
|
||
## Vercel | ||
|
||
To automatically capture the `release` value on Vercel you will need to register the `VERCEL_GITHUB_COMMIT_SHA` system environment variable in your project. | ||
|
||
## Links | ||
|
||
- [Official SDK Docs](https://docs.sentry.io/quickstart/) | ||
- [TypeDoc](http://getsentry.github.io/sentry-javascript/) |
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,77 @@ | ||
{ | ||
"name": "@sentry/gatsby", | ||
"version": "5.16.1", | ||
"description": "Offical Sentry SDK for Gatsby.js", | ||
"repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby", | ||
"author": "Sentry", | ||
"license": "BSD-3-Clause", | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "esm/index.js", | ||
"types": "dist/index.d.ts", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@sentry/browser": "5.16.1", | ||
"@sentry/types": "5.16.1" | ||
}, | ||
"peerDependencies": { | ||
"gatsby": "*" | ||
}, | ||
"devDependencies": { | ||
"jest": "^24.7.1", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "^1.17.0", | ||
"prettier-check": "^2.0.0", | ||
"rimraf": "^2.6.3", | ||
"tslint": "^5.16.0", | ||
"typescript": "^3.5.1" | ||
}, | ||
"scripts": { | ||
"build": "run-p build:es5 build:esm", | ||
"build:es5": "tsc -p tsconfig.build.json", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"build:watch": "run-p build:watch:es5 build:watch:esm", | ||
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput", | ||
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput", | ||
"clean": "rimraf dist coverage build esm", | ||
"link:yarn": "yarn link", | ||
"lint": "run-s lint:prettier lint:tslint", | ||
"lint:prettier": "prettier-check \"{src,test}/**/*.{ts,tsx}\"", | ||
"lint:tslint": "tslint -t stylish -p .", | ||
"lint:tslint:json": "tslint --format json -p . | tee lint-results.json", | ||
"fix": "run-s fix:tslint fix:prettier", | ||
"fix:prettier": "prettier --write \"{src,test}/**/*.{ts,tsx}\"", | ||
"fix:tslint": "tslint --fix -t stylish -p .", | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
}, | ||
"jest": { | ||
"collectCoverage": true, | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest", | ||
"^.+\\.tsx$": "ts-jest" | ||
}, | ||
"moduleFileExtensions": [ | ||
"js", | ||
"ts", | ||
"tsx" | ||
], | ||
"testEnvironment": "jsdom", | ||
"testMatch": [ | ||
"**/*.test.ts", | ||
"**/*.test.tsx" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "./tsconfig.json", | ||
"diagnostics": false | ||
} | ||
} | ||
}, | ||
"sideEffects": false | ||
} |
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,20 @@ | ||
exports.onClientEntry = function(_, pluginParams) { | ||
require.ensure(['@sentry/browser', '@sentry/apm'], function(require) { | ||
const Sentry = require('@sentry/browser'); | ||
const TracingIntegration = require('@sentry/apm').Integrations.Tracing; | ||
const tracesSampleRate = pluginParams.tracesSampleRate !== undefined ? pluginParams.tracesSampleRate : 0; | ||
const integrations = [...(pluginParams.integrations || [])]; | ||
if (tracesSampleRate) { | ||
integrations.push(new TracingIntegration()); | ||
} | ||
Sentry.init({ | ||
environment: process.env.NODE_ENV || 'development', | ||
release: __SENTRY_RELEASE__, | ||
dsn: __SENTRY_DSN__, | ||
...pluginParams, | ||
tracesSampleRate, | ||
integrations, | ||
}); | ||
window.Sentry = Sentry; | ||
}); | ||
}; |
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,20 @@ | ||
exports.onCreateWebpackConfig = ({ plugins, actions }) => { | ||
actions.setWebpackConfig({ | ||
plugins: [ | ||
plugins.define({ | ||
__SENTRY_RELEASE__: JSON.stringify( | ||
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables | ||
process.env.GITHUB_SHA || | ||
// Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata | ||
process.env.COMMIT_REF || | ||
// Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables | ||
process.env.VERCEL_GITHUB_COMMIT_SHA || | ||
// Zeit (now known as Vercel) | ||
process.env.ZEIT_GITHUB_COMMIT_SHA || | ||
'', | ||
), | ||
__SENTRY_DSN__: JSON.stringify(process.env.SENTRY_DSN || ''), | ||
}), | ||
], | ||
}); | ||
}; |
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,8 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*"] | ||
} |
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,8 @@ | ||
{ | ||
"extends": "../../tsconfig.esm.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "esm", | ||
}, | ||
"include": ["src/**/*"] | ||
} |
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,9 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"include": ["src/**/*.ts", "test/**/*.ts"], | ||
"exclude": ["dist"], | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"types": ["node", "jest"] | ||
} | ||
} |
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 @@ | ||
{ | ||
"extends": "@sentry/typescript/tslint" | ||
} |