Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(options)!: remove deprecated "attachCommits" and "repo" #393

Merged
merged 1 commit into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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