UNPKG

@schemifyjs/core

Version:

Core module of the SchemifyJS CLI. Provides reusable functions such as scaffolding, template handling, and general utilities.

15 lines (14 loc) 604 B
import fs from 'fs-extra'; import path from 'path'; export class ArtifactAlreadyExistsError extends Error { constructor(artifactName, artifactType, fullPath) { super(`An artifact of type "${artifactType}" with the name "${artifactName}" already exists at ${fullPath}.`); this.name = 'ArtifactAlreadyExistsError'; } static validate(artifactName, artifactType, basePath) { const fullPath = path.join(basePath, artifactName); if (fs.existsSync(fullPath)) { throw new ArtifactAlreadyExistsError(artifactName, artifactType, fullPath); } } }