diff --git a/packages/cli/src/commands/dev/dev.ts b/packages/cli/src/commands/dev/dev.ts index 26b55000700..059490805b5 100644 --- a/packages/cli/src/commands/dev/dev.ts +++ b/packages/cli/src/commands/dev/dev.ts @@ -24,10 +24,16 @@ export async function devCommand(options: DevCommandOptions, anonymousId?: strin await showWelcomeScreen(); const parsedOptions = parseOptions(options); - const devSpinner = ora('Creating a development local tunnel').start(); const NOVU_ENDPOINT_PATH = options.route; - const tunnelOrigin = await createTunnel(parsedOptions.origin, NOVU_ENDPOINT_PATH); + let tunnelOrigin: string; + + const devSpinner = ora('Creating a development local tunnel').start(); + if (parsedOptions.tunnel) { + tunnelOrigin = parsedOptions.tunnel; + } else { + tunnelOrigin = await createTunnel(parsedOptions.origin, NOVU_ENDPOINT_PATH); + } devSpinner.succeed(`🛣️ Tunnel → ${tunnelOrigin}${NOVU_ENDPOINT_PATH}`); const opts = { diff --git a/packages/cli/src/commands/dev/types.ts b/packages/cli/src/commands/dev/types.ts index c13fabb76ee..ba711adc66c 100644 --- a/packages/cli/src/commands/dev/types.ts +++ b/packages/cli/src/commands/dev/types.ts @@ -7,6 +7,7 @@ export type DevCommandOptions = { studioPort: string; dashboardUrl: string; route: string; + tunnel: string; }; export type LocalTunnelResponse = { diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 6f521cb92ee..1b868139309 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -60,7 +60,10 @@ program (e.g., npx novu@latest dev -p 4000) Running the Bridge application on a different route: - (e.g., npx novu@latest dev -r /v1/api/novu)` + (e.g., npx novu@latest dev -r /v1/api/novu) + + Running with a custom tunnel: + (e.g., npx novu@latest dev --tunnel https://my-tunnel.ngrok.app)` ) .usage('[-p ] [-r ] [-o ] [-d ] [-sp ]') .option('-p, --port ', 'The local Bridge endpoint port', '4000') @@ -68,6 +71,7 @@ program .option('-o, --origin ', 'The Bridge endpoint origin') .option('-d, --dashboard-url ', 'The Novu Cloud Dashboard URL', 'https://dashboard.novu.co') .option('-sp, --studio-port ', 'The Local Studio server port', '2022') + .option('-t, --tunnel ', 'Self hosted tunnel. e.g. https://my-tunnel.ngrok.app') .action(async (options: DevCommandOptions) => { analytics.track({ identity: {