UNPKG

@capgo/cli

Version:
49 lines (48 loc) 1.96 kB
/** * Pure generator for a GitHub Actions workflow file that runs `capgo build * request` against credentials uploaded as repository secrets. * * No I/O — caller decides where to write the resulting file. This keeps the * generator trivially testable: feed it opts, get a `{ path, content }` back. * * v1 deliberately limited: GitHub-only (no GitLab YAML), single `workflow_dispatch` * trigger (no push/pr triggers), one platform per dispatch (no matrix), no * monorepo subdirectory handling. Each of these is a follow-up. */ export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'; export type BuildScriptChoice = { type: 'npm-script'; name: string; } | { type: 'custom'; command: string; } | { type: 'skip'; }; export interface WorkflowGeneratorOpts { /** The app's bundle ID, e.g. com.example.app */ appId: string; /** Default platform when the user dispatches the workflow without overriding the input. */ defaultPlatform: 'ios' | 'android'; /** Detected via getPMAndCommand(). Drives setup actions and the `npx`/`bunx`/etc runner. */ packageManager: PackageManager; /** What runs to produce the web bundle before `capgo build request` fires. */ buildScript: BuildScriptChoice; /** Exact secret names that were pushed to GitHub (drives the env: block). */ secretKeys: string[]; } export interface GeneratedWorkflow { /** Relative path inside the repo where the file should live. */ path: string; /** Full file content, ready to write. */ content: string; } /** Default path inside the repo. */ export declare const WORKFLOW_PATH = ".github/workflows/capgo-build.yml"; /** * Build the GitHub Actions workflow YAML. * * The shape is intentionally simple: one job, one platform per dispatch, * `workflow_dispatch` trigger only. Power users can fork it after the fact. */ export declare function generateWorkflow(opts: WorkflowGeneratorOpts): GeneratedWorkflow;