Created
May 6, 2019 13:59
-
-
Save mshwery/edbc9b93ea4314580a5fecb8d8b07f68 to your computer and use it in GitHub Desktop.
Use Heroku's release feature to deploy Typescript NodeJS sourcemaps to Sentry. So you can properly debug transpiled Typescript files!
This file contains hidden or 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
// After your import's | |
if (process.env.NODE_ENV === 'production') { | |
Sentry.init({ | |
dsn: process.env.SENTRY_DSN, | |
environment: 'production', | |
release: process.env.HEROKU_SLUG_COMMIT, | |
integrations: [ | |
new Sentry.Integrations.RewriteFrames({ | |
root: __dirname | |
}) | |
] | |
}); | |
} |
This file contains hidden or 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
release: bash ./release-sentry.sh | |
web: npm start |
This file contains hidden or 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
#!/bin/sh | |
npx sentry-cli releases --org $SENTRY_ORG --project $SENTRY_PROJECT files $HEROKU_SLUG_COMMIT upload-sourcemaps dist/ --no-rewrite --validate |
This file contains hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es6", | |
"module": "commonjs", | |
"allowJs": true, | |
"moduleResolution": "node", | |
"outDir": "dist" | |
}, | |
"include": [ | |
"./src/**/*" | |
] | |
} |
This file contains hidden or 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
{ | |
"extends": "./tsconfig", | |
"compilerOptions": { | |
"sourceMap": true, | |
"inlineSources": true, | |
"sourceRoot": "/" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment