@@ -35,6 +35,10 @@ export default class GenerateTestPayload extends Command {
3535 char : 'p' ,
3636 description : 'destination actions directory path' ,
3737 default : './packages/destination-actions/src/destinations'
38+ } ) ,
39+ browser : flags . boolean ( {
40+ char : 'r' ,
41+ description : 'generate payloads for browser destinations'
3842 } )
3943 }
4044
@@ -43,6 +47,7 @@ export default class GenerateTestPayload extends Command {
4347 async run ( ) {
4448 const { flags } = this . parse ( GenerateTestPayload )
4549 let destinationName = flags . destination
50+ const isBrowser = ! ! flags . browser
4651
4752 if ( ! destinationName ) {
4853 const integrationsGlob = `${ flags . directory } /*`
@@ -78,7 +83,10 @@ export default class GenerateTestPayload extends Command {
7883
7984 this . spinner . start ( `Loading destination: ${ destinationName } ` )
8085
81- const targetDirectory = path . join ( process . cwd ( ) , flags . directory , destinationName , 'index.ts' )
86+ const cloudEntry = path . join ( process . cwd ( ) , flags . directory , destinationName , 'index.ts' )
87+ const browserEntry = path . join ( process . cwd ( ) , flags . directory , destinationName , 'src' , 'index.ts' )
88+ const targetDirectory = isBrowser ? browserEntry : cloudEntry
89+
8290 const destination = await loadDestination ( targetDirectory )
8391 if ( ! destination ) {
8492 this . error ( `Failed to load destination: ${ destinationName } ` )
0 commit comments