UNPKG

ruch

Version:

Revolutionary React TypeScript CLI with hexagonal architecture & AI-powered development assistance. Create maintainable, scalable applications with domain-driven design and integrated AI tooling.

30 lines (27 loc) 1.07 kB
import path from 'path'; import type { FileSystem } from '../utils/file-operations'; import { validateFileExists, removeFile } from '../utils/file-operations'; import { logger } from '../utils/logger'; import { logError, logSuccess, logDomainNotFound } from '../utils/logging'; import { buildDomainDirectoryPath } from '../utils/paths'; export const deleteDomain = async ( domainName: string, force: boolean = false, fileSystem: FileSystem = require('fs-extra'), log = logger ): Promise<void> => { const domainPath = buildDomainDirectoryPath(domainName); try { // Check if domain exists const domainExists = await validateFileExists(fileSystem, domainPath); if (!domainExists) { logDomainNotFound(log, domainName, domainPath); return; } // Delete domain directory await removeFile(fileSystem, domainPath); logSuccess(log, `Domain "${domainName}" deleted successfully!`); } catch (error) { logError(log, `Error deleting domain "${domainName}": ${error instanceof Error ? error.message : 'Unknown error'}`); } };