UNPKG

@jeremytenjo/super-code-generator

Version:

A powerful, fast, and scalable code generator that saves you time

71 lines (70 loc) 3 kB
import vscode from 'vscode'; import { SuperCodeGeneratorHelpersProps } from './common/generateCode/handlers/helpers'; import { ParamsFilePropsSchema, ParamsPropsSchema } from '../utils/types/ParamsPropsSchema'; export type SuperCodeGeneratorConfigSchema<CustomProps = object, ParamsFileSchema extends ParamsFilePropsSchema = ParamsFilePropsSchema> = { type: string; files: { path: (props: SuperCodeGeneratorFileProps<CustomProps, ParamsFileSchema>) => string | Promise<string>; template: (props: SuperCodeGeneratorFileProps<CustomProps, ParamsFileSchema>) => string | Promise<string>; parentFolderName?: (props: SuperCodeGeneratorFileProps<CustomProps, ParamsFileSchema>) => string; outputInRootFolder?: boolean; }[]; outputWithoutParentDir?: boolean; usageInstructions?: string; hooks?: { onCreate: (props: { outputPath: string; componentName: string; params: ParamsFileSchema; workspacePath: string; helpers: SuperCodeGeneratorHelpersProps; }) => void | Promise<void>; }; options?: { createNamedFolder?: boolean; outputInRootFolder?: boolean; formatParentFolderName?: (props: { currentName: string; helpers: SuperCodeGeneratorHelpersProps; outputPath: string; }) => { newName: string; }; }; params?: ParamsPropsSchema<ParamsFileSchema>[]; defaultParams?: Partial<ParamsFileSchema>; }[]; export type SuperCodeGeneratorTemplateSchema<CustomProps = object, ParamsFileSchema extends ParamsFilePropsSchema = ParamsFilePropsSchema> = SuperCodeGeneratorConfigSchema<CustomProps, ParamsFileSchema>[0]; export type SuperCodeGeneratorFilesSchema<CustomProps = object, ParamsFileSchema extends ParamsFilePropsSchema = ParamsFilePropsSchema> = SuperCodeGeneratorTemplateSchema<CustomProps, ParamsFileSchema>['files']; export type SuperCodeGeneratorFileProps<CustomProps = object, ParamsFileSchema = ParamsFilePropsSchema> = { name: string; nameCamelCase?: string; namePascalCase?: string; nameCapitalCase?: string; nameSnakeCase?: string; folderPath?: string; outputPath?: string; workspacePath?: string; helpers?: SuperCodeGeneratorHelpersProps; customProps?: CustomProps; type?: string; params?: ParamsFileSchema; createdFiles?: { fullPath: string; fileWorkspacePath: string; }[]; }; export type SuperCodeGeneratorUserConfigSchema = { schemaFilePath: string; prettierConfigFilePath: string; }; export type SuperCodeGeneratorSettingsSchema = { verbose: boolean; useDependencyAutoInstaller: boolean; }; /** * @param {vscode.ExtensionContext} context * {@Link https://code.visualstudio.com/api/references/vscode-api#ExtensionContext|ExtensionContext API} */ export declare function activate(context: vscode.ExtensionContext): void; export declare function deactivate(): void;