@azure/static-web-apps-cli
Version:
Azure Static Web Apps CLI
35 lines • 1.48 kB
TypeScript
/**
* Parse process.argv and retrieve a specific flag value.
* Usage:
* ```
* // ./server --port 4242
* let port = argv<number>('--port');
* ```
*
* @param flag the flag name to retrieve from argv, e.g.: --port
* @returns {T} the value of the corresponding flag:
* - if flag is --key=value or --key value, returns value as type `T`.
* - if flag is --key, return a boolean (true if the flag is present, false if not).
* - if flag is not present, return null.
*
*/
export declare function argv<T extends string | number | boolean | null>(flag: string): T;
/**
* Registers a handler when process exits and executre a callback function.
* @param callback The callback function to execute.
*/
export declare function registerProcessExit(callback: Function): void;
/**
* Parses and returns a valid script command line to be run before SWA starts. Also accepts shortcut npx, npm and yarn scripts in the form of npx:module, npm:script or yarn:script.
* @param startupScript A file or npx/npm/yarn scripts to be exectued.
* @param options The SWA CLI configuration flags.
* @returns
*/
export declare function createStartupScriptCommand(startupScript: string, options: SWACLIConfig): string | null;
/**
* Parses the string devserver-timeout and returns an integer
* @param time devserver-timeout flag as string
* @returns parses the string and returns an integer
*/
export declare function parseServerTimeout(time: string): number;
//# sourceMappingURL=cli.d.ts.map