@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
115 lines • 5.2 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 TypeScript configuration.
* Provides functionality to configure TypeScript compiler options,
* clean architecture paths, and decorator support.
*/
export declare class TypescriptModuleService 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 TypeScript configuration */
private config;
/**
* Initializes a new instance of the TypescriptModuleService.
* @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 TypeScript 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 TypeScript.
* Guides the user through setting up TypeScript compiler options.
* @returns Promise resolving to the module setup result
*/
install(): Promise<IModuleSetupResult>;
/**
* Determines if TypeScript should be installed.
* Asks the user if they want to set up TypeScript configuration.
* 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 TypeScript configuration file.
* Generates the tsconfig.json file with user-specified options.
* @param baseUrl - The base URL for module resolution
* @param rootDirectory - The root directory of source files
* @param outputDirectory - The output directory for compiled files
* @param isCleanArchitectureEnabled - Whether to enable clean architecture paths
* @param isDecoratorsEnabled - Whether to enable decorator support
*/
private createConfig;
/**
* Displays a summary of the TypeScript setup results.
* Lists configuration options, generated scripts, and files.
* @param baseUrl - The configured base URL
* @param rootDirectory - The configured root directory
* @param outputDirectory - The configured output directory
* @param isCleanArchitectureEnabled - Whether clean architecture was enabled
* @param isDecoratorsEnabled - Whether decorators were enabled
*/
private displaySetupSummary;
/**
* Finds existing TypeScript configuration files.
* @returns Promise resolving to an array of file paths for existing configuration files
*/
private findExistingConfigFiles;
/**
* Prompts the user for the base URL configuration.
* @returns Promise resolving to the base URL
*/
private getBaseUrl;
/**
* Prompts the user for the output directory configuration.
* @returns Promise resolving to the output directory
*/
private getOutDir;
/**
* Prompts the user for the root directory configuration.
* @returns Promise resolving to the root directory
*/
private getRootDir;
/**
* Prompts the user if they want to use clean architecture.
* @returns Promise resolving to true if clean architecture should be enabled
*/
private isCleanArchitectureEnabled;
/**
* Prompts the user if they want to enable decorators.
* @returns Promise resolving to true if decorators should be enabled
*/
private isDecoratorsEnabled;
/**
* Sets up npm scripts for TypeScript.
* Adds scripts for building and type checking.
*/
private setupScripts;
/**
* Sets up TypeScript configuration.
* Collects user input, installs dependencies, creates config file,
* and sets up scripts.
* @returns Promise resolving to an object containing setup parameters
*/
private setupTypescript;
}
//# sourceMappingURL=typescript-module.service.d.ts.map