Skip to content

Commit 727e7c9

Browse files
Update support for browser-destination
1 parent ac2e290 commit 727e7c9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/cli/src/commands/generate-test-payload.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)