@svgd/cli
Version:
Command-line utility for generating constants from SVG assets
45 lines (41 loc) • 1.33 kB
TypeScript
/**
* CLIOptions represent the final parsed arguments from the CLI.
*/
interface CLIOptions {
input: string;
output: string;
colors?: boolean;
quote: boolean;
template: string;
format: 'camelCase' | 'PascalCase' | 'snake_case' | 'SCREAMING_SNAKE_CASE' | 'material';
md?: string;
html?: string;
dts?: boolean;
size?: number;
}
/**
* parseCliArgs takes the process.argv and parses it using commander.
* It returns a CLIOptions object with the recognized arguments.
*/
declare function parseCliArgs(argv: string[]): CLIOptions;
/**
* GeneratedFile describes the final result for each output file:
* the path and the text content with exported constants.
*/
interface GeneratedFile {
path: string;
content: string;
}
/**
* generateSvgConstants performs the main logic:
* 1) Search for all .svg files under the given folder.
* 2) Process each SVG file, build a constant name, etc.
* 3) Return an array of GeneratedFile.
*/
declare function generateSvgConstants(options: CLIOptions): Promise<GeneratedFile[]>;
/**
* Main entry point for the CLI. It parses arguments, generates
* the output, and writes the result to disk.
*/
declare function runCLI(argv: string[]): Promise<void>;
export { type CLIOptions, type GeneratedFile, generateSvgConstants, parseCliArgs, runCLI };