@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
88 lines • 4.1 kB
TypeScript
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 lint-staged configuration.
* Provides functionality to run linters on git staged files,
* ensuring only properly formatted code is committed.
*/
export declare class LintStagedModuleService 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;
/** Cached lint-staged configuration */
private config;
/** Selected lint-staged features to configure */
private selectedFeatures;
/**
* Initializes a new instance of the LintStagedModuleService.
* @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 lint-staged 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 lint-staged.
* Guides the user through selecting linting tools and setting up git hooks.
* @returns Promise resolving to the module setup result
*/
install(): Promise<IModuleSetupResult>;
/**
* Determines if lint-staged should be installed.
* Asks the user if they want to set up lint-staged with Husky pre-commit hooks.
* 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>;
/**
* Collects all required npm dependencies for selected lint-staged features.
* @param selectedFeatures - Selected lint-staged features
* @returns Array of package names to install
*/
private collectDependencies;
/**
* Creates the lint-staged configuration file.
* @param selectedFeatures - Array of selected lint-staged features
*/
private createConfigs;
/**
* Displays a summary of the lint-staged setup results.
* Lists selected linting tools and required packages.
* @param selectedFeatures - Array of selected lint-staged features
*/
private displaySetupSummary;
/**
* Finds existing lint-staged configuration files.
* @returns Promise resolving to an array of file paths for existing configuration files
*/
private findExistingConfigFiles;
/**
* Sets up Husky git hooks.
* Initializes Husky, adds prepare script, and creates pre-commit hook.
*/
private setupHusky;
/**
* Sets up lint-staged configuration.
* Guides the user through selecting linting tools and creates necessary config files.
* @param savedFeatures - Previously saved lint-staged features
*/
private setupLintStaged;
}
//# sourceMappingURL=lint-staged-module.service.d.ts.map