UNPKG

@elsikora/setup-wizard

Version:

Setup Wizard - CLI scaffolding utility

76 lines (75 loc) 3.43 kB
import type { IModuleService } from "../../infrastructure/interface/module-service.interface"; import type { ICliInterfaceService } from "../interface/cli-interface-service.interface"; import type { ICommandService } from "../interface/command-service.interface"; import type { IConfigService } from "../interface/config-service.interface"; import type { IFileSystemService } from "../interface/file-system-service.interface"; import type { IModuleSetupResult } from "../interface/module-setup-result.interface"; import { PackageJsonService } from "./package-json.service"; /** * Service for setting up and managing Prettier code formatting. * Provides functionality to enforce consistent code style and formatting * across the project through Prettier configuration. */ export declare class PrettierModuleService implements IModuleService { /** CLI interface service for user interaction */ readonly CLI_INTERFACE_SERVICE: ICliInterfaceService; /** Command service for executing shell commands */ readonly COMMAND_SERVICE: ICommandService; /** Configuration service for managing app configuration */ readonly CONFIG_SERVICE: IConfigService; /** File system service for file operations */ readonly FILE_SYSTEM_SERVICE: IFileSystemService; /** Service for managing package.json */ readonly PACKAGE_JSON_SERVICE: PackageJsonService; /** * Initializes a new instance of the PrettierModuleService. * @param cliInterfaceService - Service for CLI user interactions * @param fileSystemService - Service for file system operations * @param configService - Service for managing app configuration */ constructor(cliInterfaceService: ICliInterfaceService, fileSystemService: IFileSystemService, configService: IConfigService); /** * Handles existing Prettier setup. * Checks for existing configuration files and asks if user wants to remove them. * @returns Promise resolving to true if setup should proceed, false otherwise */ handleExistingSetup(): Promise<boolean>; /** * Installs and configures Prettier. * Sets up configuration files and npm scripts for code formatting. * @returns Promise resolving to the module setup result */ install(): Promise<IModuleSetupResult>; /** * Determines if Prettier should be installed. * Asks the user if they want to set up Prettier for their project. * Uses the saved config value as default if it exists. * @returns Promise resolving to true if the module should be installed, false otherwise */ shouldInstall(): Promise<boolean>; /** * Creates Prettier configuration files. * Generates the main config file and ignore file. */ private createConfigs; /** * Displays a summary of the Prettier setup results. * Lists generated scripts and configuration files. */ private displaySetupSummary; /** * Finds existing Prettier configuration files. * @returns Promise resolving to an array of file paths for existing configuration files */ private findExistingConfigFiles; /** * Sets up Prettier configuration. * Installs dependencies, creates config files, and adds npm scripts. */ private setupPrettier; /** * Sets up npm scripts for Prettier. * Adds scripts for checking and fixing code formatting. */ private setupScripts; }