Skip to content

Commit cf1d2fa

Browse files
committed
feat: add dynamic release versioning for Sentry integration
1 parent 066f5c3 commit cf1d2fa

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

next.config.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
* Config based on https://github.com/elastic/next-eui-starter
55
*/
66

7+
import { execSync } from 'child_process';
78
import { withSentryConfig } from '@sentry/nextjs';
89
import dotenv from 'dotenv';
910
import webpack from 'webpack';
1011

1112
dotenv.config();
1213

14+
const gitHash = execSync('git rev-parse --short HEAD').toString().trim();
15+
1316
const pathPrefix = '';
1417

1518
const { EnvironmentPlugin, IgnorePlugin } = webpack;
@@ -274,19 +277,28 @@ export default withSentryConfig(nextConfig, {
274277
// For all available options, see:
275278
// https://github.com/getsentry/sentry-webpack-plugin#options
276279

277-
// Suppresses source map uploading logs during build
278-
silent: true,
279280
org: process.env.SENTRY_ORG,
280281
project: process.env.SENTRY_PROJECT,
281282
authToken: process.env.SENTRY_AUTH_TOKEN,
282283

284+
release: {
285+
286+
name: `${process.env.npm_package_name}@${process.env.npm_package_version}-${gitHash}`,
287+
},
288+
289+
// Suppresses source map uploading logs during build.
290+
silent: !process.env.CI,
291+
292+
// Don't send internal plugin errors and performance data to Sentry.
293+
telemetry: false,
294+
283295
// For all available options, see:
284296
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
285297

286-
// Upload a larger set of source maps for prettier stack traces (increases build time)
298+
// Upload a larger set of source maps for prettier stack traces (increases build time).
287299
widenClientFileUpload: true,
288300

289-
// Automatically tree-shake Sentry logger statements to reduce bundle size
301+
// Automatically tree-shake Sentry logger statements to reduce bundle size.
290302
disableLogger: true,
291303

292304
sourcemaps: {

0 commit comments

Comments
 (0)