UNPKG

@elsikora/setup-wizard

Version:

Setup Wizard - CLI scaffolding utility

182 lines 8.13 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 build tool configuration. * Currently supports Rollup as the build tool. */ export declare class BuilderModuleService 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 builder configuration */ private config; /** * Initializes a new instance of the BuilderModuleService. * @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 build tool 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 the build tool. * Guides the user through setting up build configuration. * @returns Promise resolving to the module setup result */ install(): Promise<IModuleSetupResult>; /** * Determines if the build tool should be installed. * Asks the user if they want to set up build tool 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 tsconfig.build.json if requested. */ private createBuildTsconfig; /** * Creates build tool configuration file. * Generates the configuration file with user-specified options. * @param tool - The selected build tool * @param entryPoint - The entry point file for the build * @param outputDirectory - The output directory for built files * @param formats - The output formats to generate * @param isSourceMapsEnabled - Whether to generate source maps * @param isMinifyEnabled - Whether to minify the output * @param isCliApp - Whether this is a CLI application * @param isPathAliasEnabled - Whether to use path aliases * @param isDecoratorsEnabled - Whether decorators are used * @param isPackageJsonGenerationEnabled - Whether to generate package.json * @param isCommonjsEnabled - Whether to include CommonJS plugin */ private createConfig; /** * Displays a summary of the build tool setup results. * Lists configuration options, generated scripts, and files. * @param tool - The selected build tool * @param entryPoint - The configured entry point * @param outputDirectory - The configured output directory * @param formats - The selected output formats * @param isSourceMapsEnabled - Whether source maps are enabled * @param isMinifyEnabled - Whether minification is enabled * @param isCleanEnabled - Whether clean is enabled * @param isCliApp - Whether this is a CLI application * @param isPathAliasEnabled - Whether path aliases are enabled * @param isDecoratorsEnabled - Whether decorators are enabled * @param isPackageJsonGenerationEnabled - Whether package.json generation is enabled * @param isBuildTsconfigEnabled - Whether build tsconfig is enabled */ private displaySetupSummary; /** * Finds existing build tool configuration files. * @returns Promise resolving to an array of file paths for existing configuration files */ private findExistingConfigFiles; /** * Prompts the user for the entry point configuration. * @returns Promise resolving to the entry point */ private getEntryPoint; /** * Prompts the user for the output directory configuration. * @param isCliApp - Whether this is a CLI application * @param toolConfig - The selected build tool configuration * @returns Promise resolving to the output directory */ private getOutputDirectory; /** * Prompts the user to select output formats. * @param isCliApp - Whether this is a CLI application * @param toolConfig - The selected build tool configuration * @returns Promise resolving to the selected formats */ private getOutputFormats; /** * Prompts the user if they want a separate build tsconfig. * @param entryPoint - The entry point to check if TypeScript * @param isCliApp - Whether this is a CLI application * @returns Promise resolving to true if build tsconfig should be created */ private isBuildTsconfigEnabled; /** * Prompts the user if they want to clean the output directory before build. * @returns Promise resolving to true if output directory should be cleaned */ private isCleanEnabled; /** * Prompts the user if this is a CLI application. * @returns Promise resolving to true if this is a CLI app */ private isCliApp; /** * Prompts the user if they need CommonJS plugin support. * @param tool - The selected build tool * @returns Promise resolving to true if CommonJS plugin should be included */ private isCommonjsEnabled; /** * Prompts the user if they use decorators. * @returns Promise resolving to true if decorators are used */ private isDecoratorsEnabled; /** * Prompts the user if they want to minify the output. * @returns Promise resolving to true if output should be minified */ private isMinifyEnabled; /** * Prompts the user if they want to generate package.json files. * @param isCliApp - Whether this is a CLI application * @returns Promise resolving to true if package.json should be generated */ private isPackageJsonGenerationEnabled; /** * Prompts the user if they want to use path aliases. * @param entryPoint - The entry point to check if TypeScript * @returns Promise resolving to true if path aliases should be used */ private isPathAliasEnabled; /** * Prompts the user if they want to generate source maps. * @returns Promise resolving to true if source maps should be generated */ private isSourceMapsEnabled; /** * Prompts the user to select a build tool. * @returns Promise resolving to the selected build tool */ private selectBuildTool; /** * Sets up the builder configuration. * Collects user input, installs dependencies, creates config files, and sets up scripts. * @returns Promise resolving to an object containing builder parameters */ private setupBuilder; /** * Sets up npm scripts for the build tool. * Adds scripts for building and watching. * @param tool - The selected build tool * @param isCleanEnabled - Whether to add prebuild clean script * @param outputDirectory - The output directory */ private setupScripts; } //# sourceMappingURL=builder-module.service.d.ts.map