Skip to content

Commit

Permalink
refactor(options)!: remove deprecated "attachCommits" and "repo" options
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The removed `attachCommits` and `repo` options can be
set through the `publishRelease` object.
  • Loading branch information
rchl committed Feb 20, 2022
1 parent 6b5e594 commit b476916
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
15 changes: 0 additions & 15 deletions docs/content/en/sentry/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,6 @@ sentry: {
- The type of source maps generated when publishing release to Sentry. See https://webpack.js.org/configuration/devtool for a list of available options
- **Note**: Consider using `hidden-source-map` instead. For most people, that should be a better option but due to it being a breaking change, it won't be set as the default until next major release
### attachCommits
- Deprecated - Set `publishRelease.setCommits.auto = true` instead.
- Type: `Boolean`
- Default: `process.env.SENTRY_AUTO_ATTACH_COMMITS || false`
- Only has effect when `publishRelease = true`
### repo
- Deprecated - use `publishRelease.setCommmits.repo` instead.
- Type: `String`
- Default: `process.env.SENTRY_RELEASE_REPO || ''`
- Only has effect when `publishRelease = true && attachCommits = true`
- Alternatively this can be set using `publishRelease.setCommmits.repo` option.
### disableServerRelease
- Type: `Boolean`
Expand Down
16 changes: 9 additions & 7 deletions lib/core/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resolve, posix } from 'path'
import merge from 'lodash.mergewith'
import * as Integrations from '@sentry/integrations'
import * as Sentry from '@sentry/node'
import { canInitialize, clientSentryEnabled, serverSentryEnabled } from './utils'
import { canInitialize, clientSentryEnabled, envToBool, serverSentryEnabled } from './utils'

const SERVER_CONFIG_FILENAME = 'sentry.server.config.js'
const SENTRY_PLUGGABLE_INTEGRATIONS = ['CaptureConsole', 'Debug', 'Dedupe', 'ExtraErrorData', 'ReportingObserver', 'RewriteFrames', 'Vue']
Expand Down Expand Up @@ -227,19 +227,21 @@ export async function webpackConfigHook (moduleContainer, webpackConfigs, option
return
}

if (options.attachCommits) {
if (!publishRelease.setCommits) {
publishRelease.setCommits = {}
}
const attachCommits = envToBool(process.env.SENTRY_AUTO_ATTACH_COMMITS)

if (attachCommits) {
publishRelease.setCommits = publishRelease.setCommits || {}

const { setCommits } = publishRelease

if (setCommits.auto === undefined) {
setCommits.auto = true
}

if (options.repo && setCommits.repo === undefined) {
setCommits.repo = options.repo
const repo = process.env.SENTRY_RELEASE_REPO || ''

if (repo && setCommits.repo === undefined) {
setCommits.repo = repo
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export default function SentryModule (moduleOptions) {
disableServerRelease: envToBool(process.env.SENTRY_DISABLE_SERVER_RELEASE) || false,
disableClientRelease: envToBool(process.env.SENTRY_DISABLE_CLIENT_RELEASE) || false,
logMockCalls: true,
attachCommits: envToBool(process.env.SENTRY_AUTO_ATTACH_COMMITS) || false,
sourceMapStyle: 'source-map',
repo: process.env.SENTRY_RELEASE_REPO || '',
tracing: false,
clientIntegrations: {
Dedupe: {},
Expand Down
4 changes: 0 additions & 4 deletions types/sentry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export interface TracingConfiguration {
}

export interface ModuleConfiguration {
/** @deprecated Set `publishRelease.setCommits.auto = true` instead. */
attachCommits?: boolean
clientConfig?: BrowserOptions
clientIntegrations?: IntegrationsConfiguration
config?: SentryOptions
Expand All @@ -66,8 +64,6 @@ export interface ModuleConfiguration {
logMockCalls?: boolean
/** See available options at https://github.com/getsentry/sentry-webpack-plugin */
publishRelease?: boolean | Partial<SentryCliPluginOptions>
/** @deprecated Set `publishRelease.setCommits.repo` instead. */
repo?: string
runtimeConfigKey?: string
serverConfig?: SentryOptions
serverIntegrations?: IntegrationsConfiguration
Expand Down

0 comments on commit b476916

Please sign in to comment.