UNPKG

@elsikora/setup-wizard

Version:

Setup Wizard - CLI scaffolding utility

76 lines (75 loc) 3.45 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 Stylelint configuration. * Provides functionality to enforce consistent CSS/SCSS code style and format * through Stylelint configuration and npm scripts. */ export declare class StylelintModuleService 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 StylelintModuleService. * @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 Stylelint 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 Stylelint. * Sets up configuration files and npm scripts for CSS/SCSS linting. * @returns Promise resolving to the module setup result */ install(): Promise<IModuleSetupResult>; /** * Determines if Stylelint should be installed. * Asks the user if they want to set up Stylelint 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 Stylelint configuration files. * Generates the main config file and ignore file. */ private createConfigs; /** * Displays a summary of the Stylelint setup results. * Lists generated scripts and configuration files. */ private displaySetupSummary; /** * Finds existing Stylelint configuration files. * @returns Promise resolving to an array of file paths for existing configuration files */ private findExistingConfigFiles; /** * Sets up npm scripts for Stylelint. * Adds scripts for linting and fixing CSS/SCSS files. */ private setupScripts; /** * Sets up Stylelint configuration. * Installs dependencies, creates config files, and adds npm scripts. */ private setupStylelint; }