@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
64 lines (63 loc) • 3.04 kB
TypeScript
import type { EEslintFeature } from "../../domain/enum/eslint-feature.enum";
import type { IFrameworkConfig } from "../../domain/interface/framework-config.interface";
import type { IFileSystemService } from "../interface/file-system-service.interface";
import type { PackageJsonService } from "./package-json.service";
/**
* Service for detecting and working with frameworks in a project.
* Provides methods to identify frameworks based on files and dependencies.
*/
export declare class FrameworkService {
/** File system service for performing file operations */
readonly FILE_SYSTEM_SERVICE: IFileSystemService;
/** Service for working with package.json */
readonly PACKAGE_JSON_SERVICE: PackageJsonService;
/**
* Initializes a new instance of the FrameworkService.
* @param fileSystemService - Service for file system operations
* @param packageJsonService - Service for managing package.json
*/
constructor(fileSystemService: IFileSystemService, packageJsonService: PackageJsonService);
/**
* Detects frameworks used in the current project.
* Checks for framework indicators like specific files or dependencies.
* @returns Promise resolving to an array of detected framework configurations
*/
detect(): Promise<Array<IFrameworkConfig>>;
/**
* Extracts and returns unique ESLint features from a list of frameworks.
* @param frameworks - Array of framework configurations
* @returns Array of unique ESLint features from all frameworks
*/
getFeatures(frameworks: Array<IFrameworkConfig>): Array<EEslintFeature>;
/**
* Gets ignore patterns for linting based on framework configurations.
* @param frameworks - Array of framework configurations
* @returns Array of file patterns to ignore during linting
*/
getIgnorePatterns(frameworks: Array<IFrameworkConfig>): Array<string>;
/**
* Gets paths to lint based on framework configurations.
* Currently returns the root directory, but could be extended to use framework-specific paths.
* @param frameworks - Array of framework configurations
* @returns Array of paths to lint
*/
getLintPaths(frameworks: Array<IFrameworkConfig>): Array<string>;
/**
* Checks if framework-specific files exist in the project.
* @param config - Framework configuration to check
* @returns Promise resolving to true if any framework-specific files are found
*/
private checkFileIndicators;
/**
* Checks if framework-specific packages are installed in the project.
* @param config - Framework configuration to check
* @returns Promise resolving to true if any framework-specific packages are found
*/
private checkPackageIndicators;
/**
* Determines if a framework is used in the project by checking files and packages.
* @param config - Framework configuration to check
* @returns Promise resolving to true if the framework is detected
*/
private isFrameworkDetected;
}