UNPKG

browse

Version:

Unified Browserbase CLI for browser automation and cloud APIs.

51 lines (50 loc) 1.68 kB
import { Args, Flags } from "@oclif/core"; import { BrowseCommand } from "../../base.js"; import { startFunctionsDevServer } from "../../lib/functions/dev.js"; export default class FunctionsDev extends BrowseCommand { static description = "Run the local Browserbase Functions development server."; static examples = [ "browse functions dev index.ts", "browse functions dev index.ts --port 3000 --verbose", ]; static args = { entrypoint: Args.string({ description: "Function entrypoint file.", required: true, }), }; static flags = { "api-key": Flags.string({ description: "Override the Browserbase API key.", helpValue: "<apiKey>", }), "base-url": Flags.string({ description: "Override the Browserbase API base URL.", helpValue: "<baseUrl>", }), host: Flags.string({ default: "127.0.0.1", description: "Host to bind to.", helpValue: "<host>", }), port: Flags.integer({ default: 14113, description: "Port to listen on.", helpValue: "<port>", }), verbose: Flags.boolean({ description: "Print verbose runtime logs.", }), }; async run() { const { args, flags } = await this.parse(FunctionsDev); await startFunctionsDevServer({ apiKey: flags["api-key"], baseUrl: flags["base-url"], entrypoint: args.entrypoint, host: flags.host, port: flags.port, verbose: flags.verbose ?? false, }); } }