From fb69aab547920d5f000367831cf8645817fba944 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 8 Aug 2023 13:17:33 +0200 Subject: [PATCH] feat: Allow ommiting `org` when using organization auth token (#368) --- packages/bundler-plugin-core/src/debug-id-upload.ts | 2 +- packages/bundler-plugin-core/src/index.ts | 4 ++-- .../bundler-plugin-core/src/plugins/release-management.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/bundler-plugin-core/src/debug-id-upload.ts b/packages/bundler-plugin-core/src/debug-id-upload.ts index fd50a17d..8ef97284 100644 --- a/packages/bundler-plugin-core/src/debug-id-upload.ts +++ b/packages/bundler-plugin-core/src/debug-id-upload.ts @@ -27,7 +27,7 @@ interface DebugIdUploadPluginOptions { sentryCliOptions: { url: string; authToken: string; - org: string; + org?: string; project: string; vcsRemote: string; silent: boolean; diff --git a/packages/bundler-plugin-core/src/index.ts b/packages/bundler-plugin-core/src/index.ts index d6062796..cba4db4f 100644 --- a/packages/bundler-plugin-core/src/index.ts +++ b/packages/bundler-plugin-core/src/index.ts @@ -205,7 +205,7 @@ export function sentryUnpluginFactory({ logger.warn( "No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" ); - } else if (!options.org) { + } else if (!options.org && !options.authToken.startsWith("sntrys_")) { logger.warn( "No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." ); @@ -247,7 +247,7 @@ export function sentryUnpluginFactory({ logger.warn( "No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" ); - } else if (!options.org) { + } else if (!options.org && !options.authToken.startsWith("sntrys_")) { logger.warn( "No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." ); diff --git a/packages/bundler-plugin-core/src/plugins/release-management.ts b/packages/bundler-plugin-core/src/plugins/release-management.ts index e9cc402b..eecd0a28 100644 --- a/packages/bundler-plugin-core/src/plugins/release-management.ts +++ b/packages/bundler-plugin-core/src/plugins/release-management.ts @@ -21,7 +21,7 @@ interface ReleaseManagementPluginOptions { sentryCliOptions: { url: string; authToken: string; - org: string; + org?: string; project: string; vcsRemote: string; silent: boolean;