UNPKG

browse

Version:

Unified Browserbase CLI for browser automation and cloud APIs.

39 lines (38 loc) 1.33 kB
import { Args, Flags } from "@oclif/core"; import { BrowseCommand } from "../../base.js"; import { publishFunction } from "../../lib/functions/publish.js"; export default class FunctionsPublish extends BrowseCommand { static description = "Package and upload a Browserbase Function build."; static examples = [ "browse functions publish index.ts --dry-run", "browse functions publish index.ts", ]; 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>", }), "dry-run": Flags.boolean({ description: "Show what would be published without uploading.", }), }; async run() { const { args, flags } = await this.parse(FunctionsPublish); await publishFunction({ apiKey: flags["api-key"], baseUrl: flags["base-url"], dryRun: flags["dry-run"] ?? false, entrypoint: args.entrypoint, }); } }