UNPKG

@tywalk/pcf-helper

Version:

Command line helper for building and publishing PCF controls to Dataverse.

44 lines (43 loc) 1.94 kB
import { Profile, WriteProfileResult } from './configUtil'; /** * Flags captured from the CLI for `profile init`. All fields are optional — * missing ones are either prompted for (interactive mode) or omitted entirely * (when `--no-interactive` is used). */ export interface ProfileInitOptions { name: string; environment?: string; publisherName?: string; publisherPrefix?: string; path?: string; template?: string; framework?: string; /** Optional session fields. If any are set the profile gets a `session` block. */ sessionUrl?: string; sessionScript?: string; sessionBundle?: string; /** Write to ~/.pcf-helper/config.json instead of ./pcf-helper.config.json. */ global?: boolean; /** Also set `defaultProfile: <name>` in the target file. */ setDefault?: boolean; /** Overwrite an existing profile of the same name. */ force?: boolean; /** Skip interactive prompts. Anything not passed as a flag is left empty. */ nonInteractive?: boolean; } /** Pluggable async prompt used to ask for a single value. Tests inject a mock. */ export type PromptFn = (question: string, currentValue?: string) => Promise<string>; /** Default prompt implementation using Node's built-in readline. */ export declare const defaultPrompt: PromptFn; /** * Builds a Profile from the options, prompting for each field when interactive. * * Returns only the fields the user actually supplied — empty answers are not * written to disk, so a skipped prompt produces no key in the profile. */ export declare function buildProfileFromOptions(options: ProfileInitOptions, prompt?: PromptFn): Promise<Profile>; /** * Orchestrates the full `profile init` flow: collect fields (prompting when * interactive), then write the profile to the target config file. */ export declare function runProfileInit(options: ProfileInitOptions, prompt?: PromptFn): Promise<WriteProfileResult>;