@@ -19,7 +19,12 @@ import {
1919 safeFlushTelemetry ,
2020} from "./sentry/telemetry" ;
2121import { Options , SentrySDKBuildFlags } from "./types" ;
22- import { arrayify , getTurborepoEnvPassthroughWarning , stripQueryAndHashFromPath } from "./utils" ;
22+ import {
23+ arrayify ,
24+ getProjects ,
25+ getTurborepoEnvPassthroughWarning ,
26+ stripQueryAndHashFromPath ,
27+ } from "./utils" ;
2328import { glob } from "glob" ;
2429import { defaultRewriteSourcesHook , prepareBundleForDebugIdUpload } from "./debug-id-upload" ;
2530
@@ -95,7 +100,7 @@ function createCliInstance(options: NormalizedOptions): SentryCli {
95100 authToken : options . authToken ,
96101 org : options . org ,
97102 // Default to the first project if multiple projects are specified
98- project : Array . isArray ( options . project ) ? options . project [ 0 ] : options . project ,
103+ project : getProjects ( options . project ) ?. [ 0 ] ,
99104 silent : options . silent ,
100105 url : options . url ,
101106 vcsRemote : options . release . vcsRemote ,
@@ -361,12 +366,8 @@ export function createSentryBuildPluginManager(
361366 if ( typeof options . moduleMetadata === "function" ) {
362367 const args = {
363368 org : options . org ,
364- project : Array . isArray ( options . project ) ? options . project [ 0 ] : options . project ,
365- projects : Array . isArray ( options . project )
366- ? options . project
367- : options . project
368- ? [ options . project ]
369- : undefined ,
369+ project : getProjects ( options . project ) ?. [ 0 ] ,
370+ projects : getProjects ( options . project ) ,
370371 release : options . release . name ,
371372 } ;
372373 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -492,7 +493,7 @@ export function createSentryBuildPluginManager(
492493 dist : options . release . dist ,
493494 // @ts -expect-error - projects is not a valid option for uploadSourceMaps but is implemented in the CLI
494495 // Remove once https://github.com/getsentry/sentry-cli/pull/2856 is released
495- projects : Array . isArray ( options . project ) ? options . project : [ options . project ] ,
496+ projects : getProjects ( options . project ) ,
496497 // We want this promise to throw if the sourcemaps fail to upload so that we know about it.
497498 // see: https://github.com/getsentry/sentry-cli/pull/2605
498499 live : "rejectOnError" ,
@@ -639,7 +640,7 @@ export function createSentryBuildPluginManager(
639640 ignore : ignorePaths ,
640641 // @ts -expect-error - projects is not a valid option for uploadSourceMaps but is implemented in the CLI
641642 // Remove once https://github.com/getsentry/sentry-cli/pull/2856 is released
642- projects : Array . isArray ( options . project ) ? options . project : [ options . project ] ,
643+ projects : getProjects ( options . project ) ,
643644 live : "rejectOnError" ,
644645 } ) ;
645646 } ) ;
@@ -752,9 +753,7 @@ export function createSentryBuildPluginManager(
752753 ] ,
753754 // @ts -expect-error - projects is not a valid option for uploadSourceMaps but is implemented in the CLI
754755 // Remove once https://github.com/getsentry/sentry-cli/pull/2856 is released
755- projects : Array . isArray ( options . project )
756- ? options . project
757- : [ options . project ] ,
756+ projects : getProjects ( options . project ) ,
758757 live : "rejectOnError" ,
759758 }
760759 ) ;
@@ -863,7 +862,7 @@ function canUploadSourceMaps(
863862 ) ;
864863 return false ;
865864 }
866- if ( ! options . project || ( Array . isArray ( options . project ) && options . project . length === 0 ) ) {
865+ if ( ! getProjects ( options . project ) ?. [ 0 ] ) {
867866 logger . warn (
868867 "No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." +
869868 getTurborepoEnvPassthroughWarning ( "SENTRY_PROJECT" )
0 commit comments